#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, int> > a[2];
vector<int> ans;
vector<pair<long long, int> > tem[2];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 3; i <= n; ++i) {
    cout << "2 1 2 " << i << endl;
    int fg;
    cin >> fg;
    if (fg == -1) fg = 0;
    cout << "1 1 2 " << i << endl;
    long long tem;
    cin >> tem;
    a[fg].push_back(make_pair(tem, i));
  }
  sort(a[0].begin(), a[0].end());
  sort(a[1].begin(), a[1].end());
  ans.push_back(1);
  if (a[0].size() != 0) {
    int u = a[0][a[0].size() - 1].second;
    for (int i = 0; i < a[0].size(); ++i) {
      int v = a[0][i].second;
      if (v == u) continue;
      long long s = a[0][i].first;
      cout << "2 1 " << u << " " << v << endl;
      int fg;
      cin >> fg;
      if (fg == -1) fg = 0;
      tem[fg].push_back(make_pair(s, v));
    }
    sort(tem[0].begin(), tem[0].end());
    sort(tem[1].begin(), tem[1].end());
    reverse(tem[1].begin(), tem[1].end());
    for (int i = 0; i < (int)tem[0].size(); ++i) {
      int v = tem[0][i].second;
      ans.push_back(v);
    }
    ans.push_back(u);
    for (int i = 0; i < (int)tem[1].size(); ++i) {
      int v = tem[1][i].second;
      ans.push_back(v);
    }
  }
  ans.push_back(2);
  tem[0].clear();
  tem[1].clear();
  if (a[1].size() != 0) {
    int u = a[1][a[1].size() - 1].second;
    for (int i = 0; i < a[1].size(); ++i) {
      int v = a[1][i].second;
      if (v == u) continue;
      long long s = a[1][i].first;
      cout << "2 1 " << u << " " << v << endl;
      int fg;
      cin >> fg;
      if (fg == -1) fg = 0;
      tem[fg].push_back(make_pair(s, v));
    }
    sort(tem[0].begin(), tem[0].end());
    sort(tem[1].begin(), tem[1].end());
    reverse(tem[1].begin(), tem[1].end());
    for (int i = 0; i < (int)tem[0].size(); ++i) {
      int v = tem[0][i].second;
      ans.push_back(v);
    }
    ans.push_back(u);
    for (int i = 0; i < (int)tem[1].size(); ++i) {
      int v = tem[1][i].second;
      ans.push_back(v);
    }
  }
  cout << "0 ";
  for (int i = 0; i < (int)ans.size(); ++i) cout << ans[i] << " ";
  cout << endl;
}
