# coding=utf-8

qtd = input()

for i in range(qtd):
    n = input()
    grid = []

    for e in range(n):
        line = raw_input()
        grid.append(line)

    count = 0
    res = ""

    # Se as celulas adjacentes a S são iguais
    if grid[0][1] == grid[1][0]:
        # Se as celulas adjacentes a F são iguais as adjacentes a S
        if grid[n - 2][n - 1] == grid[0][1] and grid[n - 1][n - 2] == grid[0][1]:
            res = (str(n - 1) + " " + str(n) + "\n" + str(n) + " " + str(n - 1))
            count += 2
        # Se as uma das celulas adjacententes a F são iguais a S
        elif grid[n - 2][n - 1] == grid[0][1] and grid[n - 1][n - 2] != grid[0][1]:
            res = str(n - 1) + " " + str(n)
            count += 1
        elif grid[n - 2][n - 1] != grid[0][1] and grid[n - 1][n - 2] == grid[0][1]:
            res = str(n) + " " + str(n - 1)
            count += 1


        print count
        print res