import sys import random import itertools popu = [[j for j in range(10)] for i in range(4)] ans = [] a = [0,1,2,3] while True: print(*a) sys.stdout.flush() x, y = map(int, input().split()) for i in range(4): for _ in range(x): popu[i].append(a[i]) for _ in range(y): for k in range(10): if k == a[i]: continue popu[i][a[i]].append(a[i]) if x == 4: exit() if x + y == 4: ans = a[:] break else: a = [random.choice(popu[i]) for i in range(4)] while any([a.count(i)>1 for i in range(10)]): a = [random.choice(popu[i]) for i in range(4)] for a in itertools.permutations(ans): print(*a) sys.stdout.flush() x, y = map(int, input().split()) if x == 4: exit()