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

for i in range(5):

    if m[i] == 0:

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

for i in range(len(m)):

    if m[i] == 0:

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

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

-for i in range(5): +for i in range(len(m)):