#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
using ll = long long;
using ld = long double;
using vi = vector<int>;
using pii = pair<int, int>;
using obj = tuple<int, int, int>;
const int oo = 1e9, mod = 1e9 + 7;
const ll loo = 1e18;
ll modpow(ll a, ll b, ll m = mod) {
  return (b ? modpow(a * a % m, b / 2, m) * (b & 1 ? a : 1) % mod : 1);
}
ll gcd(ll a, ll b) { return a ? gcd(b % a, a) : b; }
bool TEST;
const int N = 1000;
int n;
ll dist[N];
vi ans;
using point = complex<ll>;
point hull[N];
ll cross(point a, point b) {
  return (conj(a) * b).imag();
  ;
}
ll ask(int t, int i, int j, int k) {
  cout << t << " " << i + 1 << " " << j + 1 << " " << k + 1 << endl;
  if (TEST) {
    ll ans = cross(hull[j] - hull[i], hull[k] - hull[i]);
    if (t == 1)
      return abs(ans);
    else
      return ans > 0 ? 1 : -1;
  }
  fflush(stdout);
  ll res;
  cin >> res;
  return res;
}
void vet(vi a, int p) {
  if (!a.size()) {
    ans.push_back(p);
    return;
  }
  int h = a[0];
  for (int z : a)
    if (abs(dist[h]) < abs(dist[z])) h = z;
  vi c, d;
  for (int z : a)
    if (z != h) {
      if (ask(2, p, h, z) > 0)
        d.push_back(z);
      else
        c.push_back(z);
    }
  sort(begin(c), end(c),
       [&](int i, int j) { return abs(dist[i]) < abs(dist[j]); });
  sort(begin(d), end(d),
       [&](int i, int j) { return abs(dist[i]) > abs(dist[j]); });
  ans.push_back(p);
  for (int z : c) ans.push_back(z);
  ans.push_back(h);
  for (int z : d) ans.push_back(z);
}
void solve() {
  if (!TEST) cin >> n;
  int p1 = 0, p2 = 1;
  vi a, b;
  dist[0] = dist[1] = 0;
  for (int i = 0; i < n; i++)
    if (i != p1 && i != p2) {
      dist[i] = ask(2, p1, p2, i) * ask(1, p1, p2, i);
      if (dist[i] > 0)
        a.push_back(i);
      else
        b.push_back(i);
    }
  vet(b, p1);
  vet(a, p2);
  cout << 0 << " ";
  for (int z : ans) cout << z + 1 << " ";
  cout << endl;
}
void read() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    hull[i] = point(a, b);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  TEST = 0;
  if (TEST) read();
  solve();
  return 0;
}
