#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n;
  cin >> n;
  long long ma = 2;
  for (long long i = 3; i <= n; i++) {
    cout << "2 1 " << ma << " " << i << endl;
    long long f;
    cin >> f;
    if (f == -1) ma = i;
  }
  pair<double, long long> p[n];
  long long c = 0;
  for (long long i = 1; i <= n; i++) {
    if (i != 1 && i != ma) {
      cout << "1 1 " << ma << " " << i << endl;
      double f;
      cin >> f;
      p[c].first = f;
      p[c].second = i;
      c++;
    }
  }
  sort(p, p + c);
  long long ans1[n];
  long long ans2[n];
  long long c1 = 0, c2 = 0;
  for (long long i = c - 2; i >= 0; i--) {
    cout << "2 1 " << p[i].second << " " << p[c - 1].second << endl;
    long long f;
    cin >> f;
    if (f == -1) {
      ans1[c1] = p[i].second;
      c1++;
    } else {
      ans2[c2] = p[i].second;
      c2++;
    }
  }
  cout << "0 1 ";
  cout << ma << " ";
  for (long long i = c2 - 1; i >= 0; i--) cout << ans2[i] << " ";
  cout << p[c - 1].second << " ";
  for (long long i = 0; i < c1; i++) cout << ans1[i] << " ";
  cout << endl;
}
