A = int(eval(input()))

B = int(eval(input()))

 

l = [1,2,3]

l.remove(A)

l.remove(B)

 

print((l[0]))
A = int(eval(input()))

B = int(eval(input()))

 

# 頭いい方法！

print((6-A-B))
A = int(eval(input()))
B = int(eval(input()))
l = [1, 2, 3]
l.remove(A)
l.remove(B)
print((l[0]))

A = int(eval(input()))
B = int(eval(input()))
# 頭いい方法！
print((6 - A - B))

-l = [1, 2, 3] -l.remove(A) -l.remove(B) -print((l[0])) +# 頭いい方法！ +print((6 - A - B))