a, b, c, d, e = list(map(int,input().split()))



if a == 0:

  print((1))

elif b == 0:

  print((2))

elif c == 0:

  print((3))

elif d == 0:

  print((4))

elif e == 0:

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

 

for i in range(5):

    if x[i]==0:

        print((i+1))
a, b, c, d, e = list(map(int, input().split()))
if a == 0:
    print((1))
elif b == 0:
    print((2))
elif c == 0:
    print((3))
elif d == 0:
    print((4))
elif e == 0:
    print((5))

x = list(map(int, input().split()))
for i in range(5):
    if x[i] == 0:
        print((i + 1))

-a, b, c, d, e = list(map(int, input().split())) -if a == 0: -    print((1)) -elif b == 0: -    print((2)) -elif c == 0: -    print((3)) -elif d == 0: -    print((4)) -elif e == 0: -    print((5)) +x = list(map(int, input().split())) +for i in range(5): +    if x[i] == 0: +        print((i + 1))