#include <bits/stdc++.h>
using namespace std;
struct st {
  long long id, area;
  bool operator<(const st &s) const { return area < s.area; }
};
vector<st> up, dn, uprt, uplf, dnrt, dnlf;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, ar, sg = 0;
  cin >> n;
  for (long long i = 3; i <= n; i++) {
    cout << 1 << " " << 1 << " " << 2 << " " << i << endl;
    cout.flush();
    cin >> ar;
    cout << 2 << " " << 1 << " " << 2 << " " << i << endl;
    cout.flush();
    cin >> sg;
    if (sg == -1)
      dn.push_back({i, ar});
    else
      up.push_back({i, ar});
  }
  sort(up.begin(), up.end());
  sort(dn.begin(), dn.end());
  if (up.size() != 0) {
    long long top = up[up.size() - 1].id;
    for (long long i = 0; i < up.size() - 1; i++) {
      cout << 2 << " " << 1 << " " << top << " " << up[i].id << endl;
      cout.flush();
      cin >> sg;
      if (sg == 1)
        uplf.push_back(up[i]);
      else
        uprt.push_back(up[i]);
    }
  }
  if (dn.size() != 0) {
    long long bot = dn[dn.size() - 1].id;
    for (long long i = 0; i < dn.size() - 1; i++) {
      cout << 2 << " " << 1 << " " << bot << " " << dn[i].id << endl;
      cout.flush();
      cin >> sg;
      if (sg == 1)
        dnrt.push_back(dn[i]);
      else
        dnlf.push_back(dn[i]);
    }
  }
  sort(uprt.begin(), uprt.end());
  sort(uplf.begin(), uplf.end());
  sort(dnrt.begin(), dnrt.end());
  sort(dnlf.begin(), dnlf.end());
  cout << 0 << " ";
  cout << 1 << " ";
  for (long long i = 0; i < dnlf.size(); i++) cout << dnlf[i].id << " ";
  if (dn.size() != 0) cout << dn[dn.size() - 1].id << " ";
  if (dnrt.size() != 0)
    for (long long i = dnrt.size() - 1; i >= 0; i--) cout << dnrt[i].id << " ";
  cout << 2 << " ";
  for (long long i = 0; i < uprt.size(); i++) cout << uprt[i].id << " ";
  if (up.size() != 0) cout << up[up.size() - 1].id << " ";
  if (uplf.size() != 0)
    for (long long i = uplf.size() - 1; i >= 0; i--) cout << uplf[i].id << " ";
  cout << endl;
  cout.flush();
}
