import sys input = sys.stdin.read X, Y = map(int, input().split()) print(4) print(0, 0, 0, 0) sys.stdout.flush() t = 1 P00 = t print(4) print(0, 1, 0, 1) sys.stdout.flush() t = int(input()) P01 = t print(4) print(1, 0, 1, 0) sys.stdout.flush() t = int(input()) P10 = t print(4) print(1, 1, 1, 1) sys.stdout.flush() t = int(input()) P11 = t if X == 0 and Y == 0: print(P00) elif X == 0 and Y == 1: print(P01) elif X == 1 and Y == 0: print(P10) else: print(P11)