import java.io.BufferedReader ;
import java.io.BufferedWriter ;
import java.io.File ;
import java.io.FileNotFoundException ;
import java.io.FileReader ;
import java.io.InputStreamReader ;
import java.io.OutputStreamWriter ;
import java.io.PrintWriter ;
import java.util.StringTokenizer ;
public class Main {
static int [ ] [ ] killed;
static int N;
static int d;
static int tests;
tests
= Integer .
parseInt ( br.
readLine ( ) ) ;
for ( int i= 0 ; i< tests; i++ ) {
d
= Integer .
parseInt ( br.
readLine ( ) ) ; N
= Integer .
parseInt ( br.
readLine ( ) ) ; killed = new int [ 1025 ] [ 1025 ] ;
for ( int j= 0 ; j< N; j++ ) {
int x
= Integer .
parseInt ( st.
nextToken ( ) ) ; int y
= Integer .
parseInt ( st.
nextToken ( ) ) ; int c
= Integer .
parseInt ( st.
nextToken ( ) ) ; for ( int f = x- d; f<= x+ d; f++ ) {
for ( int k= y- d; j<= k+ d; k++ ) {
if ( f>= 0 && k>= 0 && k< 1025 && f< 1025 ) killed[ f] [ k] = killed[ f] [ k] + c;
}
}
}
int max = - 1 ;
int xc = - 1 ;
int yc = - 1 ;
for ( int x= 0 ; x< 1025 ; x++ ) {
for ( int y= 0 ; y< 1025 ; y++ ) {
if ( killed[ x] [ y] > max) {
xc = x;
yc = y;
max = killed[ x] [ y] ;
}
}
}
sb.append ( xc+ " " + yc+ " " + max+ "\n " ) ;
}
}
}
aW1wb3J0IGphdmEuaW8uQnVmZmVyZWRSZWFkZXI7CmltcG9ydCBqYXZhLmlvLkJ1ZmZlcmVkV3JpdGVyOwppbXBvcnQgamF2YS5pby5GaWxlOwppbXBvcnQgamF2YS5pby5GaWxlTm90Rm91bmRFeGNlcHRpb247CmltcG9ydCBqYXZhLmlvLkZpbGVSZWFkZXI7CmltcG9ydCBqYXZhLmlvLklucHV0U3RyZWFtUmVhZGVyOwppbXBvcnQgamF2YS5pby5PdXRwdXRTdHJlYW1Xcml0ZXI7CmltcG9ydCBqYXZhLmlvLlByaW50V3JpdGVyOwppbXBvcnQgamF2YS51dGlsLlN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