def read_int():
    return int(input())


def read_ints():
    return map(int, input().split(' '))


t = read_int()
for case_num in range(t):
    n = read_int()
    a = []
    for i in range(n):
        a.append(input())
    ans = []
    if a[n - 1][n - 2] == a[n - 2][n - 2]:
        ans.append((n, n - 1))
    if a[n - 2][n - 1] == a[n - 2][n - 2]:
        ans.append((n - 1, n))
    print(len(ans))
    for r, c in ans:
        print(r, c)
