#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; auto ask = [&](int u, int v){ int res; cout << "1 " << u + 1 << " " << v + 1 << endl; cin >> res; return res == -1 ? -1 : res - 1; }; vector a(n); for(int i = 0; i < n; i++) a[i] = ask(i, i); vector dp(n); auto rec = [&](auto rec, int v) -> int { if (dp[v] != 0) return dp[v]; return dp[v] = 1 + (a[v] == -1 ? 0 : rec(rec, a[v])); }; int p = -1, mx = -1; for(int i = 0; i < n; i++){ if(rec(rec, i) > mx){ mx = dp[i]; p = i; } } vector ans(n); for(int i = 1, v = p; i <= n; i += 2){ if(i != 1) v = ask(v, a[p]); ans[v] = i; int v2 = a[v], c = i; while(v2 != -1){ ans[v2] = (c += c); v2 = a[v2]; } } cout << "2"; for(int i = 0; i < n; i++){ cout << ' ' << ans[i]; } cout << endl; }