X = [int(i) for i in input().split()]

print((X.index(0) + 1))
print((15-sum([int(i) for i in input().split()])))
X = [int(i) for i in input().split()]
print((X.index(0) + 1))

print((15 - sum([int(i) for i in input().split()])))

-X = [int(i) for i in input().split()] -print((X.index(0) + 1)) +print((15 - sum([int(i) for i in input().split()])))