#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s[200];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  int c = 0;
  int a[2][2];
  if (s[0][1] != s[1][0]) {
    c++;
    a[0][0] = 1, a[0][1] = 2;
  }
  if (s[n - 1][n - 2] != s[n - 2][n - 1]) {
    c++;
    a[1][0] = n - 1;
    a[1][1] = n;
  }
  cout << c << "\n";
  for (int i = 0; i < c; i++) {
    cout << a[i][0] << ' ' << a[i][1] << "\n";
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
