I=input
exec(int(I())*"n=int(I());a=[[*map(ord,I())]for _ in[0]*n];a=a[0][1],a[1][0],a[-2][-1]^1,a[-1][-2]^1;a=*zip(map(a.count,a),a,('1 2','2 1',f'{n-1} {n}',f'{n} {n-1}')),;r=[z for x,y,z in a if y!=max(a)[1]];print(len(r),*r);")