#include <bits/stdc++.h>
using namespace std;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const long long MOD = 1000000007;
const int inf = 1 << 30;
const long long linf = 1LL << 60;
long long n;
vector<pair<long long, long long> > x[2];
vector<long long> topr, topl, botr, botl;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (long long i = 3; i <= n; i++) {
    cout << 2 << " " << 1 << " " << 2 << " " << i << endl;
    cout.flush();
    long long v1;
    cin >> v1;
    cout << 1 << " " << 1 << " " << 2 << " " << i << endl;
    cout.flush();
    long long v2;
    cin >> v2;
    if (v1 > 0)
      x[0].push_back(pair<long long, long long>(v2, i));
    else
      x[1].push_back(pair<long long, long long>(v2, i));
  }
  sort(x[0].begin(), x[0].end());
  sort(x[1].begin(), x[1].end());
  long long las = (long long)x[0].size() - 1;
  for (int i = 0; i < (int)(long long)x[0].size() - 1; i++) {
    cout << 2 << " " << 1 << " " << x[0][las].second << " " << x[0][i].second
         << endl;
    cout.flush();
    long long v;
    cin >> v;
    if (v < 0)
      topr.push_back(x[0][i].second);
    else
      topl.push_back(x[0][i].second);
  }
  las = (long long)x[1].size() - 1;
  for (int i = 0; i < (int)(long long)x[1].size() - 1; i++) {
    cout << 2 << " " << 1 << " " << x[1][las].second << " " << x[1][i].second
         << endl;
    cout.flush();
    long long v;
    cin >> v;
    if (v < 0)
      botl.push_back(x[1][i].second);
    else
      botr.push_back(x[1][i].second);
  }
  cout << 0 << " " << 1;
  for (int i = 0; i < (int)botl.size(); i++) cout << " " << botl[i];
  if (x[1].size()) cout << " " << x[1][(int)x[1].size() - 1].second;
  for (int j = (int)botr.size() - 1; j >= 0; j--) cout << " " << botr[j];
  cout << " " << 2;
  for (int i = 0; i < (int)topr.size(); i++) cout << " " << topr[i];
  if (x[0].size()) cout << " " << x[0][(int)x[0].size() - 1].second;
  for (int j = (int)topl.size() - 1; j >= 0; j--) cout << " " << topl[j];
  cout << endl;
  cout.flush();
}
