import java.util.*;

public class Solution {

	public static void main(String[] args) {
	Scanner sc =new Scanner(System.in);
	int t=sc.nextInt();
	int n=0;
	int count=0;
	while(t--!=0) {
		count=0;
		n=sc.nextInt();
		String[] a=new String[n];
		sc.nextLine();
		for(int i=0;i<n;i++) a[i]=sc.nextLine();
		
		char p=a[0].charAt(1);
		char q=a[1].charAt(0);
		char r=a[n-2].charAt(n-1);
		char s=a[n-1].charAt(n-2);
		int [][] rc=new int[4][2];
		
		if(p==q) {
			if(r==p) {
				count++;
				rc[2][0]=n-1;
				rc[2][1]=n;
			}
			if(s==p) {
				count++;
				rc[3][1]=n-1;
				rc[3][0]=n;
			}
		}else if(r==s) {
			if(r==p) {
				count++;
				rc[0][0]=1;
				rc[0][1]=2;
			}
			if(s==q) {
				count++;
				rc[1][0]=2;
				rc[1][1]=1;
			}
		}else {
			if(p==r) {
				count=2;
				rc[0][0]=1;
				rc[0][1]=2;
				rc[3][1]=n-1;
				rc[3][0]=n;
			}else {
				rc[0][0]=1;
				rc[0][1]=2;
				rc[2][0]=n-1;
				rc[2][1]=n;
			}
		}
		System.out.println(count);
		for(int i=0;i<4;i++) {
			if(rc[i][0]!=0)System.out.println(rc[i][0]+" "+rc[i][1]);
			
		}
		}sc.close();
	
	}

}