A = int(eval(input()))

B = int(eval(input()))



if A == 1 and B == 3:

    print((2))

elif A == 1 and B == 2:

    print((3))

elif A == 2 and B == 1:

    print((3))

elif A == 2 and B == 3:

    print((1))

elif A == 3 and B == 1:

    print((2))

elif A == 3 and B == 2:

    print((1))
A = int(eval(input()))

B = int(eval(input()))



print((6-A-B))
A = int(eval(input()))
B = int(eval(input()))
if A == 1 and B == 3:
    print((2))
elif A == 1 and B == 2:
    print((3))
elif A == 2 and B == 1:
    print((3))
elif A == 2 and B == 3:
    print((1))
elif A == 3 and B == 1:
    print((2))
elif A == 3 and B == 2:
    print((1))

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

-if A == 1 and B == 3: -    print((2)) -elif A == 1 and B == 2: -    print((3)) -elif A == 2 and B == 1: -    print((3)) -elif A == 2 and B == 3: -    print((1)) -elif A == 3 and B == 1: -    print((2)) -elif A == 3 and B == 2: -    print((1)) +print((6 - A - B))