for _ in range(int(input())):
    n = int(input())
    arr = []
    for i in range(n):
        arr.append([ch for ch in input()])
    # print(arr)
    count = 0
    if arr[0][1] == arr[n-2][n-1]:
        count += 1
    if arr[1][0] == arr[n-1][n-2]:
        count += 1
    print(count)
    if arr[0][1] == arr[n-2][n-1]:
        print(1, 2)
    if arr[1][0] == arr[n-1][n-2]:
        print(2, 1)