import sys import random import itertools ans = [] a,b,c,d = random.sample([0,1,2,3,4,5,6,7,8,9],4) while True: print(a,b,c,d) sys.stdout.flush() x,y =map(int, input().split()) if x == 4: exit() if x + y == 4: ans = [a,b,c,d] break else: a,b,c,d = random.sample([0,1,2,3,4,5,6,7,8,9],4) for a in itertools.permutations(ans): print(*a) sys.stdout.flush() x,y=map(int, input().split()) if x==4: exit()