from collections import defaultdict,deque N=int(input()) path=defaultdict(list) for i in range(1,N+1): print(1,i,i,flush=True) k=int(input()) if k==-1: k=0 path[k].append(i) path[i].append(k) Q=deque() now=0 Q.append(0) check=set() check.add(0) while len(Q)>0: p=Q.popleft() now=p for j in path[p]: if j not in check: check.add(j) Q.append(j) ans=[0]*(N+1) ans[now]=1 one=now for i in range(1,N): print(1,one,now,flush=True) k=int(input()) ans[k],now=i+1,k ans[0]=2 print(*ans,flush=True)