import itertools use=[] lst=[] for i in range(7): print(i,7,8,9) X,Y=map(int,input().split()) if (X,Y)==(4,0): exit() lst.append(X+Y) ma=max(lst) for i in range(7): if lst[i]==ma: use.append(i) lst=[] for i in range(3,10): print(0,1,2,i) X,Y=map(int,input().split()) if (X,Y)==(4,0): exit() lst.append(X+Y) ma=max(lst) for i in range(7,10): if lst[i-3]==ma: use.append(i) for tpl in itertools.permutations(use): print(*tpl) X,Y=map(int,input().split()) if (X,Y)==(4,0): exit()