import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Task2 {
    public static void main(String[] args) {
        FastReader fr = new FastReader();
        int N = fr.nextInt();

        for (; N != 0; N--) {
            int size = fr.nextInt();
            char[][] map = new char[size][size];

            for (int i = 0; i < size; i++) {
                String line = fr.nextLine();

                map[i] = line.toCharArray();
            }

            String[][] s = new String[][] {
                    new String[] {String.valueOf(map[1][0]), "2 1"},
                    new String[] {String.valueOf(map[0][1]), "1 2"}
            };

            String[][] f = new String[][] {
                    new String[] {
                            String.valueOf(map[size - 2][size - 1]),
                            (size - 1) + " " + (size)
                    },
                    new String[] {
                            String.valueOf(map[size - 1][size - 2]),
                            (size) + " " + (size - 1)
                    }
            };

            if (s[0][0] == s[1][0]) {
                if (f[0][0] == f[1][0]) {
                    if (s[0][0] == f[0][0]) {
                        System.out.println("2");
                        System.out.println(s[0][1]);
                        System.out.println(s[1][1]);
                    }
                } else {
                    if (s[0][0] == f[0][0]) {
                        System.out.println("1");
                        System.out.println(f[0][1]);
                    } else {
                        System.out.println("1");
                        System.out.println(f[1][1]);
                    }
                }
            } else {
                if (f[0][0] == f[1][0]) {
                    if (s[0][0] == f[0][0]) {
                        System.out.println("1");
                        System.out.println(s[0][0]);
                    } else {
                        System.out.println("1");
                        System.out.println(s[1][0]);
                    }
                } else {
                    if (s[0][0] != f[0][0]) {
                        System.out.println("2");
                        System.out.println(s[0][1]);
                        System.out.println(f[0][1]);
                    } else if (s[0][0] != f[1][0]) {
                        System.out.println("2");
                        System.out.println(s[1][0]);
                        System.out.println(f[1][1]);
                    } else if (s[1][0] == f[0][0]) {
                        System.out.println("2");
                        System.out.println(s[1][1]);
                        System.out.println(f[0][1]);
                    } else {
                        System.out.println("2");
                        System.out.println(s[1][1]);
                        System.out.println(f[1][1]);
                    }
                }
            }
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        private String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}
