import sys from collections import * from itertools import * def check(L): print(*L) sys.stdout.flush() x, y = map(int, input().split()) if [x, y] == [4, 0]: exit() return x, y x, y = check([0, 1, 2, 3]) default = x + y L = [0, 1, 2, 3] ans = set() for i in range(4): D = defaultdict(list) ma = 0 for j in range(4, 10): L[i] = j x, y = check(L) D[x + y].append(j) ma = max(ma, x + y) L[i] = i if ma == default + 1: for v in D[ma]: ans.add(v) else: ans.add(i) for t in permutations(ans): check(t)