test_case_num = int(input())

for i in range(test_case_num):
    a = int(input())
    list = []
    for k in range(a):
        list.append(input())

    cnt = 0
    if list[0][1] == "1":
        cnt+=1
    if list[1][0] == "1":
        cnt+=1
    if list[a-2][a-1] == "0":
        cnt+=1
    if list[a-1][a-2] == "0":
        cnt+=1

    print(cnt)

    if list[0][1] == "1":
        print(1, 2)
    if list[1][0] == "1":
        print(2,1)
    if list[a-2][a-1] == "0":
        print(a-1,a)
    if list[a-1][a-2] == "0":
        print(a, a-1)