for _ in range(int(input())):
    l=[]
    n=int(input())
    for j in range(n):
        l.append(input())
    a,b,c,d = l[0][1] , l[1][0] , l[n-1][n-2] , l[n-2][n-1]
    sol = []
    count=0
    if a!="0":
        count +=1
        sol.append([1,2])
    if b!="0":
        count +=1
        sol.append([2,1])
    if c!="1":
        count +=1
        sol.append([n,n-1])
    if d!="1":
        count +=1
        sol.append([n-1,n])
    print(count)
    if count!=0:
        for q in sol:
            s = str(q[0]) + " " + str(q[1])
            print(s)