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
    ans = []

    if b=='1':
        if a=='1':
            ans.append((n, n-1))
        
        if c=='1':
            ans.append((n-1, n))
    
    else:
        if a=='0':
            ans.append((n, n-1))
        
        if c=='0':
            ans.append((n-1, n))

    print(len(ans))
    for x, y in ans:
        print(x, y)