#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n;
  char a[205][205];
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i < n + 1; i++) {
      for (int j = 1; j < n + 1; j++) cin >> a[i][j];
    }
    char w, x, y, z;
    w = a[1][2];
    x = a[2][1];
    y = a[n - 1][n];
    z = a[n][n - 1];
    if ((w == y && x == y) || (w == z && x == z))
      cout << "2" << endl
           << "1" << ' ' << "2" << endl
           << "2" << ' ' << "1" << endl;
    else {
      if (w == y)
        cout << "1" << endl << "1" << ' ' << "2";
      else if (x == y)
        cout << "1" << endl << "2" << ' ' << "1";
      else if (w == z)
        cout << "1" << endl << "1" << ' ' << "2";
      else if (x == z)
        cout << "1" << endl << "2" << ' ' << "1";
      else
        cout << "0" << endl;
    }
  }
  return 0;
}
