s=[1,2,3]

for _ in range(2):

	s.remove(int(eval(input())))

print((s[0]))
print((6-int(eval(input()))-int(eval(input()))))
s = [1, 2, 3]
for _ in range(2):
    s.remove(int(eval(input())))
print((s[0]))

print((6 - int(eval(input())) - int(eval(input()))))

-s = [1, 2, 3] -for _ in range(2): -    s.remove(int(eval(input()))) -print((s[0])) +print((6 - int(eval(input())) - int(eval(input()))))