#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<long long, int>> l, r;
  for (int i = 3; i <= n; i++) {
    long long h, s;
    cout << 1 << " " << 1 << " " << 2 << " " << i << endl;
    cin >> h;
    cout << 2 << " " << 1 << " " << 2 << " " << i << endl;
    cin >> s;
    s == -1 ? l.emplace_back(h, i) : r.emplace_back(h, i);
  }
  sort(l.begin(), l.end(), greater<pair<long long, int>>()),
      sort(r.begin(), r.end(), greater<pair<long long, int>>());
  deque<int> dl, dr;
  if (!l.empty()) {
    dl.push_back(l[0].second);
    for (int i = 1; i < l.size(); i++) {
      int s;
      cout << 2 << " " << l[0].second << " " << l[i].second << " " << 1 << endl;
      cin >> s;
      s == -1 ? dl.push_front(l[i].second) : dl.push_back(l[i].second);
    }
  }
  if (!r.empty()) {
    dr.push_back(r[0].second);
    for (int i = 1; i < r.size(); i++) {
      int s;
      cout << 2 << " " << r[0].second << " " << r[i].second << " " << 2 << endl;
      cin >> s;
      s == -1 ? dr.push_front(r[i].second) : dr.push_back(r[i].second);
    }
  }
  cout << 0 << " " << 1 << " ";
  for (auto& x : dl) cout << x << " ";
  cout << 2 << " ";
  for (auto& x : dr) cout << x << " ";
  cout << endl;
}
