#include <bits/stdc++.h>
char d[201][201];
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cin >> d[i][j];
      }
    }
    int ans = 0;
    if (d[n - 1][n - 2] == '0') {
      ans++;
    }
    if (d[n - 2][n - 1] == '0') {
      ans++;
    }
    cout << ans << endl;
    for (int i = 0; i < ans; i++) {
      if (d[n - 1][n - 2] == '0') {
        cout << n - 1 << " " << n << endl;
      }
      if (d[n - 2][n - 1] == '0') {
        cout << n << " " << n - 1 << endl;
      }
    }
  }
  return 0;
}
