#include <bits/stdc++.h>
using namespace std;
long long ask(int t, int i, int j, int k) {
  long long ret;
  cout << t << " " << i << " " << j << " " << k << endl;
  cin >> ret;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  int nearest = 2;
  cin >> n;
  vector<long long> area(n + 1);
  for (int i = 3; i <= n; i++) {
    if (ask(2, 1, nearest, i) == -1) {
      nearest = i;
    }
  }
  long long mxArea = 0;
  int idx = -1;
  for (int i = 2; i <= n; i++) {
    if (i == nearest) continue;
    area[i] = ask(1, 1, nearest, i);
    if (mxArea < area[i]) {
      mxArea = area[i];
      idx = i;
    }
  }
  vector<pair<long long, int> > Left, Right;
  for (int i = 2; i <= n; i++) {
    if (i == nearest || i == idx) continue;
    if (ask(2, 1, idx, i) == -1) {
      Left.push_back({area[i], i});
    } else {
      Right.push_back({area[i], i});
    }
  }
  sort(Left.begin(), Left.end());
  sort(Right.rbegin(), Right.rend());
  cout << 0 << " " << 1 << " " << nearest;
  for (auto p : Left) cout << " " << p.second;
  cout << " " << idx;
  for (auto p : Right) cout << " " << p.second;
  cout << endl;
  return 0;
}
