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

for i in range(5):

    if x[i] == 0:

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

for i in range(5):

    if x[i] == 0:

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

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

-x = tuple(map(int, input().split())) +x = list(map(int, input().split()))