lst = []
for i in range(1, 6):
w = input()
if "FBI" in w:
lst.append(i)
if lst:
print(*lst)
else:
print("HE GOT AWAY!")
lst = []
for i in range(1, 6):
w = input()
if "FBI" in w:
lst.append(i)
if lst:
print(*lst)
else:
print("HE GOT AWAY!")