#include <bits/stdc++.h>
using namespace std;
int medi(int l, int r) { return (r + l) / 2; }
int main() {
  int n;
  long long a;
  cin >> n;
  int bst = 2;
  for (int i = 3; i <= n; i++) {
    cout << "2 1 " << bst << " " << i << endl;
    cin >> a;
    if (a < 0) bst = i;
  }
  vector<pair<long long, int> > v;
  for (int i = 2; i <= n; i++) {
    if (i != bst) {
      cout << "1 1 " << bst << " " << i << endl;
      cin >> a;
      v.push_back({a, i});
    }
  }
  sort(v.begin(), v.end());
  int longest = v[v.size() - 1].second;
  stack<int> neg;
  queue<int> pos;
  for (int i = v.size() - 2; i >= 0; i--) {
    cout << "2 1 " << longest << " " << v[i].second << endl;
    cin >> a;
    if (a > 0)
      pos.push(v[i].second);
    else
      neg.push(v[i].second);
  }
  cout << "0 1 " << bst;
  while (!neg.empty()) {
    cout << " " << neg.top();
    neg.pop();
  }
  cout << " " << longest;
  while (!pos.empty()) {
    cout << " " << pos.front();
    pos.pop();
  }
  cout << endl;
  return 0;
}
