FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()

    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
rrmm = lambda n: [rrm() for _ in xrange(n)]

####
MOD = 10**9 + 7
YES, NO = "Yes", "No"
from collections import defaultdict as ddic


def solve(N, A):
    ans = []
    if A[0][1] == '0':
        ans.append((0, 1))
    if A[1][0] == '0':
        ans.append((1, 0))
    return ans


for TC in xrange(rri()):
    N = rri()
    A = [rr() for _ in xrange(N)]
    ans = solve(N, A)
    print len(ans)
    for x, y in ans:
        print x + 1, y + 1
