a, b = map(int, input().split())
m = a % 4

for i in range(12):
    if i % 4 == m and i != a and i != b:
        print(i)