x1, x2, x3, x4, x5 = list(map(int, input().split()))



if x1 ==0:

  print((1))

  

if x2 ==0:

  print((2))

  

if x3 ==0:

  print((3))

  

if x4 ==0:

  print((4))



if x5 ==0:

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



for i in range(5):

  if x[i] == 0:

    print((i + 1))
x1, x2, x3, x4, x5 = list(map(int, input().split()))
if x1 == 0:
    print((1))
if x2 == 0:
    print((2))
if x3 == 0:
    print((3))
if x4 == 0:
    print((4))
if x5 == 0:
    print((5))

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

-x1, x2, x3, x4, x5 = list(map(int, input().split())) -if x1 == 0: -    print((1)) -if x2 == 0: -    print((2)) -if x3 == 0: -    print((3)) -if x4 == 0: -    print((4)) -if x5 == 0: -    print((5)) +x = list(map(int, input().split())) +for i in range(5): +    if x[i] == 0: +        print((i + 1))