#include using namespace std; using ll = long long; 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), ans(n, -1); 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++){ rec(rec, i); if(dp[i] > mx){ mx = dp[i]; p = i; } } ans[p] = 1; for(int i = 2, v = p; i <= n; i++){ v = ask(v, p); ans[v] = i; } cout << "2"; for(int i = 0; i < n; i++){ cout << ' ' << ans[i]; } cout << endl; }