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