#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T, typename T1>
T amax(T& a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T& a, T1 b) {
  if (b < a) a = b;
  return a;
}
const long long INF = 1e18;
const int32_t M = 1e9 + 7;
const int32_t MM = 998244353;
const long long N = 1005;
long long query(long long t, long long i, long long j, long long k) {
  cout << t << " " << i << " " << j << " " << k << endl;
  long long val;
  cin >> val;
  return val;
}
long long dis[N];
void solve() {
  long long n;
  cin >> n;
  long long best = 2;
  for (long long i = 3; i < n + 1; i++) {
    if (query(2, 1, best, i) > 0) {
      best = i;
    }
  }
  for (long long i = 2; i < n + 1; i++) {
    if (i == best) {
      continue;
    }
    dis[i] = query(1, 1, best, i);
  }
  long long far = 2;
  for (long long i = 2; i < n + 1; i++) {
    if (dis[far] < dis[i]) {
      far = i;
    }
  }
  vector<long long> left, right;
  for (long long i = 2; i < n + 1; i++) {
    if (i == far) continue;
    if (query(2, 1, far, i) > 0) {
      left.push_back(i);
    } else {
      right.push_back(i);
    }
  }
  sort((left).begin(), (left).end(),
       [&](long long a, long long b) { return dis[a] > dis[b]; });
  sort((right).begin(), (right).end(),
       [&](long long a, long long b) { return dis[a] < dis[b]; });
  cout << "0 1 ";
  for (long long x : right) {
    cout << x << " ";
  }
  cout << far << " ";
  for (long long x : left) {
    cout << x << " ";
  }
  cout << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
