#include <bits/stdc++.h>
using namespace std;
long long query(long long t, long long i, long long j, long long k) {
  cout << t << ' ' << i << ' ' << j << ' ' << k << ' ' << '\n';
  cout.flush();
  long long res;
  cin >> res;
  return res;
}
void solve() {
  long long n;
  cin >> n;
  long long t1 = 1;
  long long oo = 5e18;
  vector<pair<long long, long long>> area(n + 1, {-oo, -1});
  for (long long i = 1; i <= n; ++i) area[i].second = i;
  long long t2 = 2;
  for (long long i = 3; i <= n; ++i) {
    long long q2 = query(2, t1, t2, i);
    t2 = (q2 > 0 ? t2 : i);
  }
  long long mid = 3, max_s = 0;
  for (long long i = 2; i <= n; ++i) {
    if (i == t2) continue;
    long long q1 = query(1, t1, t2, i);
    area[i].first = q1;
    if (q1 > max_s) {
      max_s = q1;
      mid = i;
    }
  }
  area[mid].first = 0;
  for (long long i = 2; i <= n; ++i) {
    if (i == t2 || i == mid) continue;
    long long q2 = query(2, t1, mid, i);
    if (q2 > 0) area[i].first = oo - area[i].first;
    if (q2 < 0) area[i].first = -oo + area[i].first;
  }
  sort(area.begin() + 1, area.end());
  cout << "0 ";
  for (long long i = 1; i <= n; ++i)
    cout << area[i].second << (i == n ? '\n' : ' ');
}
int main() {
  solve();
  return 0;
}
