X, Y = map(int, input().split()) if X == Y: print(4, flush=True) print(X, Y, X, Y, flush=True) t = int(input()) ans = set() for p00 in [0, 1]: for p01 in [0, 1]: for p10 in [0, 1]: for p11 in [0, 1]: P = [[p00, p01], [p10, p11]] if P[P[P[X][Y]][X]][Y] == t: ans.add(P[X][Y]) if len(ans) == 1: print(*ans) exit() else: print(4, flush=True) print(X, Y, Y, Y, flush=True) t = int(input()) ans = set() for p00 in [0, 1]: for p01 in [0, 1]: for p10 in [0, 1]: for p11 in [0, 1]: P = [[p00, p01], [p10, p11]] if P[P[P[X][Y]][Y]][Y] == t: ans.add(P[X][Y]) if len(ans) == 1: print(*ans) exit() # def test(a): # for p00 in [0, 1]: # for p01 in [0, 1]: # for p10 in [0, 1]: # for p11 in [0, 1]: # P = [[p00, p01], [p10, p11]] # r = P[a[0]][a[1]] # for i in range(2, len(a)): # r = P[r][a[i]] # if r != P[0][1]: # return False # return True # for l in range(3, 10): # for i in range(1 << l): # a = [] # for j in range(l): # if (i >> j) & 1 == 1: # a.append(1) # else: # a.append(0) # if test(a): # print(*a) # exit()