a,b=list(map(int,open(0)));print((a^b))
print((6-sum(map(int,open(0)))))
a, b = list(map(int, open(0)))
print((a ^ b))

print((6 - sum(map(int, open(0)))))

-a, b = list(map(int, open(0))) -print((a ^ b)) +print((6 - sum(map(int, open(0)))))