x,y = map(int,input().split()) line = [ [0,4,8], [1,5,9], [2,6,10] ,[3,7,11]] for i in line: if x in i: ans = i i.remove(x) i.remove(y) print(*ans) break