l = input().split()

print((l.index('0')+1))

x = list(map(int, input().split()))

print((x.index(0) + 1))

l = input().split()
print((l.index("0") + 1))

x = list(map(int, input().split()))
print((x.index(0) + 1))

-l = input().split() -print((l.index("0") + 1)) +x = list(map(int, input().split())) +print((x.index(0) + 1))