#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 42;
const long long mod7 = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int right = 2;
  for (int i = 3; i <= n; i++) {
    cout << 2 << " " << 1 << " " << right << " " << i << endl;
    int c;
    cin >> c;
    if (c < 0) right = i;
  }
  vector<pair<long long, long long>> areas;
  for (int j = 2; j <= n; j++) {
    if (j != right) {
      cout << 1 << " " << 1 << " " << right << " " << j << endl;
      long long area;
      cin >> area;
      areas.push_back({area, j});
    }
  }
  sort(areas.rbegin(), areas.rend());
  vector<pair<long long, long long>> lefte;
  vector<pair<long long, long long>> righte;
  for (int i = 1; i < areas.size(); i++) {
    cout << 2 << " " << 1 << " " << areas[0].second << " " << areas[i].second
         << endl;
    int c;
    cin >> c;
    if (c < 0)
      righte.push_back(areas[i]);
    else
      lefte.push_back(areas[i]);
  }
  sort(righte.begin(), righte.end());
  sort(lefte.rbegin(), lefte.rend());
  cout << 0 << " ";
  cout << 1 << " " << right << " ";
  for (auto p : righte) cout << p.second << " ";
  cout << areas[0].second;
  for (auto p : lefte) cout << " " << p.second;
  cout << endl;
  return 0;
}
