import sys
if sys.subversion[0] == "PyPy":
    import io, atexit
    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))
    
    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()

RS = raw_input
RI = lambda x=int: map(x,RS().split())
RN = lambda x=int: x(RS())
''' ...................................................................... '''

for _ in xrange(RN()):
    n = RN()
    mat = [RS() for i in xrange(n)]

    a,b = n-1,n-2-1
    x,y = n-2-1,n-1

    out = []

    if mat[a][b] == mat[a][b+1]:
        out.append([a+1,b+1])

    if mat[b][a] == mat[b+1][a]:
        out.append([b+1,a+1])

    print len(out)
    for ii in out:
        print ii[0],ii[1]
