#include <cstdio>
#include <string>
#include <vector>
using namespace std;

const int dir[][2] = {
	{-1, 0},
	{1, 0},
	{0, -1},
	{0, 1}
};

int main() {
	int T;
	scanf("%d", &T);
	while (T--) {
		int N, M;
		scanf("%d %d", &N, &M);
		vector<vector<char>> V(N+4, vector<char>(M+4, '\0'));
		for (int i = 0; i < N; ++i)
			for (int j = 0; j < M; ++j)
				scanf(" %c", &V[i+2][j+2]);
		bool 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
					ce += V[i][j] == V[i+dir[d][0]][j+dir[d][1]];
					ce += V[i][j] == V[i+2*dir[d][0]][j+2*dir[d][1]];
					if (ce == 2) {
						found = true;
						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) printf("no set found\n");
	}
	return 0;
}
