test = int(input())
for _ in range(test):
    n = int(input())
    mat = []
    for i in range(n):
        mat.append(list(input()))
    
    a = mat[-1][-2]
    b = mat[-2][-2]
    c = mat[-2][-1]

    use = 0
    v = 0
    if a==b:
        use+=1
        v = (n, n-1)
    
    if c==b:
        use+=1
        v = (n-1, n)

    if use==0:
        print(0)
    elif use==1:
        print(1)
        print(v[0], v[1])
    else:
        print(2)
        print(n, n-1)
        print(n-1, n)