import java.util.Scanner;

class solution {
	static final int[][] dir = {{-1, 0}, {1,0}, {0,-1}, {0,1}};
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		for (int t = 0; t < T; ++t) {
			int N = sc.nextInt();
			int M = sc.nextInt();
			String[][] V = new String[N+4][M+4];
			for (int i = 0; i < N; ++i)
				for (int j = 0; j < M; ++j)
					V[i+2][j+2] = sc.next();
			boolean found = false;
			for (int i = 2; i < N+2; ++i) if (!found)
				for (int j = 2; j < M+2; ++j) if (!found)
					for (int d = 0; d < 4; ++d) if (!found) {
						int ce = 0; // count equals
						if (V[i][j].equals(V[i+dir[d][0]][j+dir[d][1]])) ce++;
						if (V[i][j].equals(V[i+2*dir[d][0]][j+2*dir[d][1]])) ce++;
						if (ce != 2) continue; // didn't find
						found = true;
						System.out.printf("%d %d %d %d %d %d\n",
								i-1, j-1,
								i+dir[d][0]-1, j+dir[d][1]-1,
								i+2*dir[d][0]-1, j+2*dir[d][1]-1);
					}
			if (!found) System.out.println("no set found");
		}
	}
}
