A = int(eval(input()))

B = int(eval(input()))



print((*(set([1, 2, 3])  -set([A, B]))))

A = int(eval(input()))

B = int(eval(input()))



print((6 - A - B))

A = int(eval(input()))
B = int(eval(input()))
print((*(set([1, 2, 3]) - set([A, B]))))

A = int(eval(input()))
B = int(eval(input()))
print((6 - A - B))

-print((*(set([1, 2, 3]) - set([A, B])))) +print((6 - A - B))