for i in range(int(input())):
    s=input()
    for j in range(1,11):
        if s[0:j]==s[j:2*(j)]:
            break
    print(f'#{i+1} {j}')
375c21a6550376e85f22b4abe5103e9e58fe4fa3
<mask token>

for i in range(int(input())):
    s = input()
    for j in range(1, 11):
        if s[0:j] == s[j:2 * j]:
            break
    print(f'#{i + 1} {j}')

for i in range(int(input())):
    s=input()
    for j in range(1,11):
        if s[0:j]==s[j:2*(j)]:
            break
    print(f'#{i+1} {j}')