#include <bits/stdc++.h>
using namespace std;
long long n;
long long sup;
long long sign[1005];
long long area[1005];
long long sign2[1005];
vector<long long> sol(vector<long long> idxs) {
  if (idxs.empty()) return idxs;
  long long max_idx = -1;
  for (long long u : idxs) {
    cout << 1 << " " << 1 << " " << sup << " " << u << endl;
    cout.flush();
    cin >> area[u];
    if (max_idx == -1 || area[u] > area[max_idx]) max_idx = u;
  }
  for (long long u : idxs)
    if (u != max_idx) {
      cout << 2 << " " << 1 << " " << max_idx << " " << u << endl;
      cout.flush();
      cin >> sign2[u];
    }
  vector<long long> U, D;
  for (long long u : idxs)
    if (u != max_idx) {
      if (sign2[u] == 1)
        U.emplace_back(u);
      else
        D.emplace_back(u);
    }
  U.emplace_back(max_idx);
  sort(U.begin(), U.end(),
       [=](long long a, long long b) -> bool { return area[a] < area[b]; });
  sort(D.begin(), D.end(),
       [=](long long a, long long b) -> bool { return area[a] > area[b]; });
  vector<long long> ret;
  for (auto v : {U, D})
    for (long long u : v) ret.emplace_back(u);
  return ret;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  sup = 2;
  for (long long i = 3; i <= n; i++) {
    cout << 2 << " " << 1 << " " << sup << " " << i << endl;
    cout.flush();
    cin >> sign[i];
  }
  vector<long long> U, D;
  for (long long i = 3; i <= n; i++)
    if (sign[i] == 1)
      U.emplace_back(i);
    else
      D.emplace_back(i);
  vector<long long> A = sol(U), B = sol(D);
  vector<long long> ans;
  for (long long u : A) ans.emplace_back(u);
  ans.emplace_back(sup);
  for (long long u : B) ans.emplace_back(u);
  cout << 0 << " " << 1;
  for (long long i = n - 2; i >= 0; i--) cout << " " << ans[i];
  cout << endl;
  cout.flush();
  return 0;
}
