#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
void solve() {
  int n;
  cin >> n;
  char a[n][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) cin >> a[i][j];
  }
  vector<pair<int, int> > x;
  int cnt = 0;
  if (a[0][1] == a[n - 1][n - 2]) {
    x.push_back({(n), (n - 1)});
    cnt++;
  }
  if (a[0][1] == a[n - 2][n - 1]) {
    x.push_back({(n - 1), (n)});
    cnt++;
  }
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++) {
    cout << x[i].first << " " << x[i].second << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
