# swea 1216 '회문2'

T = 10
for t in range(1, T+1):
    t = int(input())
    MAP = []
    for _ in range(100):
        MAP.append(list(input()))

    max_length = 0
    for length in range(100, 0, -1):
        for i in range(100 - length + 1):
            for j in range(100 - length + 1):
                j_offset = 0
                j_flag = True
                while j_offset < length // 2:
                    if MAP[i][j + j_offset] != MAP[i][j + length - 1 - j_offset]:
                        j_flag = False
                        break
                    j_offset += 1

                if j_flag:
                    max_length = length
                    break

                i_offset = 0
                i_flag = True
                while i_offset < length // 2:
                    if MAP[i + i_offset][j] != MAP[i + length - 1 - i_offset][j]:
                        i_flag = False
                        break
                    i_offset += 1

                if i_flag:
                    max_length = length
                    break
            if max_length:
                break
        if max_length:
            break

    print('#{} {}'.format(t, max_length))

+ Recent posts