T = 10

for t in range(1, T+1):
    int(input())
    MAP = [[0 for _ in range(102)] for _ in range(100)]
    for i in range(100):
        MAP[i][1:-1] = map(int, input().split())

    start_j = 0
    for j in range(1, 101):
        if MAP[99][j] == 2:
            start_j = j
            break

    i = 99
    j = start_j
    while i:
        if MAP[i][j + 1]:
            while MAP[i][j + 1]:
                j += 1
            i -= 1
        elif MAP[i][j - 1]:
            while MAP[i][j - 1]:
                j -= 1
            i -= 1
        else:
            i -= 1

    result = j - 1
    print('#{} {}'.format(t, result))

+ Recent posts