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

print((x.index(0)+1))
print((15-sum(map(int,input().split()))))
x = list(map(int, input().split()))
print((x.index(0) + 1))

print((15 - sum(map(int, input().split()))))

-x = list(map(int, input().split())) -print((x.index(0) + 1)) +print((15 - sum(map(int, input().split()))))