n = int(input()) to = [-1] * n for i in range(n): print(f"1 {i + 1} {i + 1}", flush=True) j = int(input()) if j == -1: to[i] = j else: to[i] = j - 1 dist = [-1] * n def dfs(x): if dist[x] != -1: return dist[x] if to[x] == -1: dist[x] = 0 return 0 dist[x] = dfs(to[x]) + 1 return dist[x] ma = -1 one = -1 for i in range(n): dfs(i) if ma < dist[i]: ma = dist[i] one = i P = [0] * n P[one] = 1 now = one for i in range(2, n + 1): print(f"1 {one + 1} {now + 1}", flush=True) now = int(input()) - 1 P[now] = i print(2, " ".join(map(str, P)), flush=True)