#include namespace { #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic warning "-Wunused-function" using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; int ask(int i, int j) { cout << 1 << ' ' << i + 1 << ' ' << j + 1 << endl; int res; cin >> res; if (res != -1) res--; return res; } } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; dsu uf(n); VI idx(n, 1); rep(i, n) { while (true) { if (idx[i] != 1) break; vector seen(n + 1, -1); rep(j, n) if (uf.same(i, j)) seen[idx[j]] = j; bool end = true; for (int c1 = 2; c1 <= n; c1++) { if (seen[c1] == -1) { int res = ask(i, seen[c1-1]); if (res == -1) break; int c2 = idx[res]; int g = gcd(c1, c2); int m1 = c2 / g, m2 = c1 / g; rep(j, n) { if (uf.same(i, j)) idx[j] *= m1; else if (uf.same(res, j)) idx[j] *= m2; } uf.merge(i, res); end = false; break; } } if (end) break; } } assert(uf.size(0) == n); cout << 2; for (int i : idx) cout << ' ' << i; cout << endl; }