Problem: Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like [walls](https://www.youtube.com/watch?v=YR5ApYxkU-U), he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.

Roger Waters has a square grid of size n× n and he wants to traverse his grid from the upper left (1,1) corner to the lower right corner (n,n). Waters can move from a square to any other square adjacent by a side, as long as he is still in the grid. Also except for the cells (1,1) and (n,n) every cell has a value 0 or 1 in it.

Before starting his traversal he will pick either a 0 or a 1 and will be able to only go to cells values in which are equal to the digit he chose. The starting and finishing cells (1,1) and (n,n) are exempt from this rule, he may go through them regardless of picked digit. Because of this the cell (1,1) takes value the letter 'S' and the cell (n,n) takes value the letter 'F'.

For example, in the first example test case, he can go from (1, 1) to (n, n) by using the zeroes on this path: (1, 1), (2, 1), (2, 2), (2, 3), (3, 3), (3, 4), (4, 4)

The rest of the band (Pink Floyd) wants Waters to not be able to do his traversal, so while he is not looking they will invert at most two cells in the grid (from 0 to 1 or vice versa). They are afraid they will not be quick enough and asked for your help in choosing the cells.  Note that you cannot invert cells (1, 1) and (n, n).

We can show that there always exists a solution for the given constraints.

Also note that Waters will pick his digit of the traversal after the band has changed his grid, so he must not be able to reach (n,n) no matter what digit he picks.

Input

Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 50). Description of the test cases follows.

The first line of each test case contains one integers n (3 ≤ n ≤ 200).

The following n lines of each test case contain the binary grid, square (1, 1) being colored in 'S' and square (n, n) being colored in 'F'.

The sum of values of n doesn't exceed 200.

Output

For each test case output on the first line an integer c (0 ≤ c ≤ 2) — the number of inverted cells.

In i-th of the following c lines, print the coordinates of the i-th cell you inverted. You may not invert the same cell twice.  Note that you cannot invert cells (1, 1) and (n, n).

Example

Input


3
4
S010
0001
1000
111F
3
S10
101
01F
5
S0101
00000
01111
11111
0001F


Output


1
3 4
2
1 2
2 1
0

Note

For the first test case, after inverting the cell, we get the following grid:
    
    
      
    S010  
    0001  
    1001  
    111F  
    

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
ll fac[1000001];
void pre() {
  fac[0] = fac[1] = 1;
  for (int i = 2; i <= 1000001; i++) {
    fac[i] = (fac[i - 1] * 1LL * i) % mod;
  }
}
ll binpower(ll a, ll n) {
  ll res = 1;
  while (n) {
    if (n % 2) res = (res * 1LL * a) % mod;
    n /= 2;
    a = (a * 1LL * a) % mod;
  }
  return res;
}
ll nCrmod(ll n, ll r) {
  ll res = fac[n];
  res = (res * 1LL * binpower(fac[r], mod - 2)) % mod;
  res = (res * 1LL * binpower(fac[n - r], mod - 2)) % mod;
  return res;
}
long long ncr(int n, int r) {
  if (r > n - r) r = n - r;
  long long ans = 1;
  int i;
  for (i = 1; i <= r; i++) {
    ans *= n - r + i;
    ans /= i;
  }
  return ans;
}
ll modexp(ll a, ll b, ll m) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    ll y = modexp(a, b / 2, m);
    return (y * y) % m;
  } else {
    return ((a % m) * modexp(a, b - 1, m)) % m;
  }
}
ll modinv(ll a, ll m) { return modexp(a, m - 2, m); }
void SieveOfEratosthenes(ll n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (ll p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (ll i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (ll p = 2; p <= n; p++)
    if (prime[p]) cout << p << " ";
}
vector<int> Centroid(vector<int> g[], int n) {
  vector<int> centroid;
  vector<int> sz(n + 1);
  function<void(int, int)> dfs = [&](int u, int prev) {
    sz[u] = 1;
    bool is_centroid = true;
    for (auto v : g[u])
      if (v != prev) {
        dfs(v, u);
        sz[u] += sz[v];
        if (sz[v] > n / 2) is_centroid = false;
      }
    if (n - sz[u] > n / 2) is_centroid = false;
    if (is_centroid) centroid.push_back(u);
  };
  dfs(1, 0);
  return centroid;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    char grid[n + 1][n + 1];
    for (int i = 1; i <= n; i++) {
      string s;
      cin >> s;
      for (int j = 1; j <= n; j++) {
        grid[i][j] = s[j - 1];
      }
    }
    char a = grid[1][2], b = grid[2][1], c = grid[n][n - 1], d = grid[n - 1][n];
    if (a == b) {
      int ans = 0;
      vector<pair<int, int>> v;
      if (a == '0') {
        if (c == '0') {
          ans++;
          v.push_back({n, n - 1});
        }
        if (d == '0') {
          ans++;
          v.push_back({n - 1, n});
        }
      }
      if (a == '1') {
        if (c == '1') {
          ans++;
          v.push_back({n, n - 1});
        }
        if (d == '1') {
          ans++;
          v.push_back({n - 1, n});
        }
      }
      cout << ans << "\n";
      for (auto x : v) {
        cout << x.first << " " << x.second << "\n";
      }
    } else {
      int ans = 0;
      vector<pair<int, int>> v;
      if (c == d) {
        if (c == '0') {
          if (a == '0') {
            ans++;
            v.push_back({1, 2});
          }
          if (b == '0') {
            ans++;
            v.push_back({2, 1});
          }
        } else {
          if (a == '1') {
            ans++;
            v.push_back({1, 2});
          }
          if (b == '1') {
            ans++;
            v.push_back({2, 1});
          }
        }
      } else {
        if (c == '1') {
          ans++;
          v.push_back({n, n - 1});
          if (a == '0') {
            ans++;
            v.push_back({1, 2});
          }
          if (b == '0') {
            ans++;
            v.push_back({2, 1});
          }
        } else {
          ans++;
          v.push_back({n, n - 1});
          if (a == '1') {
            ans++;
            v.push_back({1, 2});
          }
          if (b == '1') {
            ans++;
            v.push_back({2, 1});
          }
        }
      }
      cout << ans << "\n";
      for (auto x : v) {
        cout << x.first << " " << x.second << "\n";
      }
    }
  }
  return 0;
}