import java.util.*;
import java.io.*;
import java.math.*;
public class Euler {
	 
    public static void main(String[] args){
        FastReader in = new FastReader();
        PrintWriter o = new PrintWriter(System.out);
        
        int t = in.nextInt();
        
        while (t-- > 0) {
			
			int n = in.nextInt();
			char[][] ch = new char[n][n];
			for (int i = 0;i < n; i++) {
				String str = in.nextLine();
				for (int j = 0;j < str.length(); j++) {
					ch[i][j] = str.charAt(j);
				}
			}
			
			boolean bol = false;
			
			for (int i1 = 1; i1 < n; i1++) {
				for (int j1 = 1; j1 < n; j1++) {
					for (int i2 = i1 + 1; i2 < n; i2++) {
						for (int j2 = j1 + 1; j2 < n; j2++) {
							
							if (ch[i1][j1] == '0') {
								ch[i1][j1] = '1';
							} else {
								ch[i1][j1] = '0';
							}
							
							if (ch[i2][j2] == '1') {
								ch[i2][j2] = '0';
							} else {
								ch[i2][j2] = '1';
							}
							
							ch[0][0] = '0';
							
							boolean b = bfs(0, 0, ch, n);
							if (!b) {
								o.println(2);
								o.println((i1 + 1) + " " + (j1 + 1));
								o.println((i2 + 1) + " " + (j2 + 1));
								bol = true;
								break;
							}
							
							ch[0][0] = '1';
							b = bfs(0, 0, ch, n);
							if (!b) {
								o.println(2);
								o.println((i1 + 1) + " " + (j1 + 1));
								o.println((i2 + 1) + " " + (j2 + 1));
								bol = true;
								break;
							}
							
							if (ch[i1][j1] == '0') {
								ch[i1][j1] = '1';
							} else {
								ch[i1][j1] = '0';
							}
							
							if (ch[i2][j2] == '1') {
								ch[i2][j2] = '0';
							} else {
								ch[i2][j2] = '1';
							}
							
							
						}
						if (bol) break;
					}
					if (bol) break;
				}
				if (bol) break;
			}
			
			
		}
        
        
        
        
        
        o.close();
        o.flush();
        return;
    }
    
    public static boolean bfs(int i, int j, char[][] ch, int n) {
		
		Queue<pair> q = new LinkedList<>();
		q.add(new pair(i, j));
		
		while (!q.isEmpty()) {
			
			pair p = q.poll();
			int x = p.x;
			int y = p.y;
			
			if (x + 1 < n && ch[x + 1][y] == ch[x][y]) {
				pair p1 = new pair(x + 1, y);
				q.add(p1);
				if (ch[x + 1][y] == 'F') {
					return true;
				}
			}
			if (y + 1 < n && ch[x][y + 1] == ch[x][y]) {
				pair p1 = new pair(x, y + 1);
				q.add(p1);
				if (ch[x][y + 1] == 'F') {
					return true;
				}
			}
			
			
		}
		
		return false;
		
	}
    
    public static class pair {
		int x;
		int y;
		public pair (int x, int y) {
			this.x = x;
			this.y = y;
		}
	}
    
    
    
    
    
    
    
    
    
    
    public static void sort(int[] arr) {
		ArrayList<Integer> ar = new ArrayList<>();
		for (int i = 0; i < arr.length; i++) {
			ar.add(arr[i]);
		}
		Collections.sort(ar);
		for (int i = 0; i < arr.length; i++) {
			arr[i] = ar.get(i);
		}
	}
   
    static final Random random=new Random();
 
    static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		sort(a);
	}
    
   
	
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        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());
        }
 
        long nextLong() {
            return Long.parseLong(next());
        }
 
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }
 
        long[] readLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) a[i] = nextLong();
            return a;
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
 
 
}
