#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int minn = 2;
  int out;
  for (int i = 3; i <= n; i++) {
    cout << 2 << " " << 1 << " " << minn << " " << i << endl;
    cin >> out;
    if (out == -1) minn = i;
  }
  vector<pair<long long int, long long int> > pts;
  long long int area;
  for (int i = 2; i <= n; i++) {
    if (i != minn) {
      cout << 1 << " " << 1 << " " << minn << " " << i << endl;
      cin >> area;
      pts.push_back({area, i});
    }
  }
  sort(pts.begin(), pts.end());
  reverse(pts.begin(), pts.end());
  vector<int> dir;
  dir.assign(pts.size(), 0);
  for (int i = 1; i < pts.size(); i++) {
    if (pts[i].second != minn and pts[i].second != 1) {
      cout << 2 << " " << 1 << " " << pts[i].second << " " << pts[0].second
           << endl;
      cin >> out;
      dir[i] = out;
    }
  }
  vector<int> ans;
  ans.assign(n + 1, 0);
  ans[1] = 1;
  ans[2] = minn;
  int pos = 3;
  for (int i = 1; i < pts.size(); i++)
    if (dir[i] == 1) pos++;
  ans[pos] = pts[0].second;
  int l = pos, r = pos;
  for (int i = 1; i < pts.size(); i++) {
    if (dir[i] == 1) {
      ans[--r] = pts[i].second;
    } else {
      ans[++l] = pts[i].second;
    }
  }
  cout << "0 ";
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
}
