#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<pair<LL, int>> lp, rp;
  for (int i = 3; i <= n; ++i) {
    cout << "1 1 2 " << i << endl << flush;
    LL area;
    cin >> area;
    cout << "2 1 2 " << i << endl << flush;
    int t;
    cin >> t;
    if (t > 0) {
      lp.push_back({area, i});
    } else {
      rp.push_back({area, i});
    }
  }
  sort(lp.begin(), lp.end());
  sort(rp.begin(), rp.end());
  vector<int> ll, lr;
  if (lp.size() == 0) {
  } else if (lp.size() == 1) {
    ll.push_back(lp[0].second);
  } else {
    for (int i = 1; i < lp.size(); ++i) {
      cout << 2 << " " << 1 << " " << lp[i - 1].second << " " << lp[i].second
           << endl
           << flush;
      int t;
      cin >> t;
      if (t > 0) {
        lr.push_back(lp[i - 1].second);
      } else {
        ll.push_back(lp[i - 1].second);
      }
    }
    ll.push_back(lp.back().second);
  }
  vector<int> rl, rr;
  if (rp.size() == 0) {
  } else if (rp.size() == 1) {
    rl.push_back(rp[0].second);
  } else {
    for (int i = 1; i < rp.size(); ++i) {
      cout << 2 << " " << 1 << " " << rp[i - 1].second << " " << rp[i].second
           << endl
           << flush;
      int t;
      cin >> t;
      if (t > 0) {
        rr.push_back(rp[i - 1].second);
      } else {
        rl.push_back(rp[i - 1].second);
      }
    }
    rl.push_back(rp.back().second);
  }
  vector<int> ans;
  ans.push_back(1);
  for (int i = 0; i < rr.size(); ++i) ans.push_back(rr[i]);
  reverse(rl.begin(), rl.end());
  for (int i = 0; i < rl.size(); ++i) ans.push_back(rl[i]);
  ans.push_back(2);
  for (int i = 0; i < lr.size(); ++i) ans.push_back(lr[i]);
  reverse(ll.begin(), ll.end());
  for (int i = 0; i < ll.size(); ++i) ans.push_back(ll[i]);
  cout << 0;
  for (int i = 0; i < ans.size(); ++i) cout << " " << ans[i];
  cout << endl << flush;
  return 0;
}
