T=int(input())

for Tid in range(T):
    n=int(input())
    ans=[]
    for i in range(n):
        a=input()
        if i==n-2 and a[n-1]=='0':
            ans.append([n-1,n])
        if i==n-1 and a[n-2]=='0':
            ans.append([n,n-1])
    print(len(ans))
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1])