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 JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Collection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Queue;
import java.io.FileReader;
import java.util.LinkedList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BPuttingBricksInTheWall solver = new BPuttingBricksInTheWall();
        solver.solve(1, in, out);
        out.close();
    }

    static class BPuttingBricksInTheWall {
        int ROW;
        int COL;
        int[] rowNum = {-1, 0, 0, 1};
        int[] colNum = {0, -1, 1, 0};

        boolean isValid(int row, int col) {
            // return true if row number and
            // column number is in range
            return (row >= 0) && (row < ROW) &&
                    (col >= 0) && (col < COL);
        }

        int BFS(int mat[][], Point src,
                Point dest) {
            // check source and destination cell
            // of the matrix have value 1
            if (mat[src.x][src.y] != 1 ||
                    mat[dest.x][dest.y] != 1)
                return -1;

            boolean[][] visited = new boolean[ROW][COL];

            // Mark the source cell as visited
            visited[src.x][src.y] = true;

            // Create a queue for BFS
            Queue<queueNode> q = new LinkedList<>();

            // Distance of source cell is 0
            queueNode s = new queueNode(src, 0);
            q.add(s); // Enqueue source cell

            // Do a BFS starting from source cell
            while (!q.isEmpty()) {
                queueNode curr = q.peek();
                Point pt = curr.pt;

                // If we have reached the destination cell,
                // we are done
                if (pt.x == dest.x && pt.y == dest.y)
                    return curr.dist;

                // Otherwise dequeue the front cell
                // in the queue and enqueue
                // its adjacent cells
                q.remove();

                for (int i = 0; i < 4; i++) {
                    int row = pt.x + rowNum[i];
                    int col = pt.y + colNum[i];

                    // if adjacent cell is valid, has path
                    // and not visited yet, enqueue it.
                    if (isValid(row, col) &&
                            mat[row][col] == 1 &&
                            !visited[row][col]) {
                        // mark cell as visited and enqueue it
                        visited[row][col] = true;
                        queueNode Adjcell = new queueNode(new Point(row, col),
                                curr.dist + 1);
                        q.add(Adjcell);
                    }
                }
            }

            // Return -1 if destination cannot be reached
            return -1;
        }

        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            int t = 1;
            t = sc.nextInt();
            loop:
            while (t-- > 0) {
                int n = sc.nextInt();
                ROW = n;
                COL = n;
                char[][] arr = new char[n][n];
                for (int i = 0; i < n; i++) arr[i] = sc.nextLine().toCharArray();
                int[][] mat1 = new int[n][n];
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < n; j++) {
                        mat1[i][j] = (arr[i][j] == '0' || arr[i][j] == 'F' || arr[i][j] == 'S') ? 1 : 0;
                    }
                }
                int[][] mat2 = new int[n][n];
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < n; j++) {
                        mat2[i][j] = (arr[i][j] == '1' || arr[i][j] == 'F' || arr[i][j] == 'S') ? 1 : 0;
                    }
                }
                ArrayList<Point> ans = new ArrayList<>();
                Point Start = new Point(0, 0);
                Point end = new Point(n - 1, n - 1);
//		   for(int[]h:mat1)pw.println(Arrays.toString(h));
//		   pw.println();
//		   for(int[]h:mat2)pw.println(Arrays.toString(h));
                if (BFS(mat1, Start, end) == -1 && BFS(mat2, Start, end) == -1) {
                    pw.println(0);
                    continue loop;
                } else {
                    Point[] a = new Point[4];
                    a[0] = new Point(0, 1);
                    a[1] = new Point(1, 0);
                    a[2] = new Point(n - 1, n - 2);
                    a[3] = new Point(n - 2, n - 1);
                    for (int i = 0; i < a.length; i++) {
                        int x = a[i].x;
                        int y = a[i].y;
                        mat1[x][y] = 1 - mat1[x][y];
                        mat2[x][y] = 1 - mat2[x][y];
                        if (BFS(mat1, Start, end) == -1 && BFS(mat2, Start, end) == -1) {
                            pw.println(1);
                            pw.println(x + 1 + " " + (y + 1));
                            continue loop;
                        }
                        mat1[x][y] = 1 - mat1[x][y];
                        mat2[x][y] = 1 - mat2[x][y];
                    }
                    for (int i = 0; i < a.length; i++) {
                        for (int j = i + 1; j < a.length; j++) {
                            int x = a[i].x;
                            int y = a[i].y;
                            int x1 = a[j].x;
                            int y1 = a[j].y;
                            mat1[x][y] = 1 - mat1[x][y];
                            mat2[x][y] = 1 - mat2[x][y];
                            mat1[x1][y1] = 1 - mat1[x1][y1];
                            mat2[x1][y1] = 1 - mat2[x1][y1];
                            if (BFS(mat1, Start, end) == -1 && BFS(mat2, Start, end) == -1) {
                                pw.println(2);
                                pw.println(x + 1 + " " + (y + 1));
                                pw.println(x1 + 1 + " " + (y1 + 1));
                                continue loop;
                            }
                            mat1[x][y] = 1 - mat1[x][y];
                            mat2[x][y] = 1 - mat2[x][y];
                            mat1[x1][y1] = 1 - mat1[x1][y1];
                            mat2[x1][y1] = 1 - mat2[x1][y1];
                        }
                    }

                }
            }
        }

        class Point {
            int x;
            int y;

            public Point(int x, int y) {
                this.x = x;
                this.y = y;
            }

        }

        class queueNode {
            Point pt;
            int dist;

            public queueNode(Point pt, int dist) {
                this.pt = pt;
                this.dist = dist;
            }

        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String nextLine() {
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }

    }
}