#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> area(n + 1);
  int p1 = 1, p2 = 2;
  int res;
  for (int i = 3; i <= n; i++) {
    cout << "2 " << p1 << " " << p2 << " " << i << endl;
    cin >> res;
    if (res < 0) p2 = i;
  }
  for (int i = 2; i <= n; i++) {
    if (i != p2) {
      cout << "1 " << p1 << " " << p2 << " " << i << endl;
      cin >> area[i];
    }
  }
  vector<int> ind;
  for (int i = 2; i <= n; i++) {
    if (i != p2) ind.push_back(i);
  }
  sort(ind.begin(), ind.end(), [&](int i, int j) { return area[i] < area[j]; });
  vector<int> l, r;
  int mxp = ind.back();
  for (int i = 0; i < n - 3; i++) {
    cout << "2 " << p1 << " " << mxp << " " << ind[i] << endl;
    cin >> res;
    if (res < 0)
      l.push_back(ind[i]);
    else
      r.push_back(ind[i]);
  }
  cout << "0 1 " << p2;
  for (int i : l) cout << " " << i;
  cout << " " << mxp;
  reverse(r.begin(), r.end());
  for (int i : r) cout << " " << i;
  cout << endl;
  return 0;
}
