x = list(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(0, 5):

    if x[i] != 0:

        pass

    else:

    	print((i+1))
x = list(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(0, 5):
    if x[i] != 0:
        pass
    else:
        print((i + 1))

-for i in range(5): -    if x[i] == 0: +for i in range(0, 5): +    if x[i] != 0: +        pass +    else: