import sys from itertools import combinations as comb from itertools import permutations as perm print('0 1 2 3') sys.stdout.flush() hit, blow = map(int, input().split()) a = hit + blow if hit == 4: exit() print('4 5 6 7') sys.stdout.flush() hit, blow = map(int, input().split()) b = hit + blow if hit == 4: exit() c = 4 - (a + b) #count = 0 for x in comb([0,1,2,3],a): for y in comb([4,5,6,7],b): for z in comb([8,9],c): #count += 1 num4 = sum([list(x),list(y),list(z)],[]) print('{} {} {} {}'.format(*num4)) sys.stdout.flush() hit, blow = map(int, input().split()) if hit == 4: exit() if hit + blow == 4: align = num4 break else: continue break else: continue break for j in perm(align): print('{} {} {} {}'.format(*j)) sys.stdout.flush() hit, blow = map(int, input().split()) if hit == 4: exit()