#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int n, tmp;
long long dt[N];
vector<int> up, down, upL, upR, downL, downR;
bool cmp1(int a, int b) { return dt[a] < dt[b]; }
bool cmp2(int a, int b) { return dt[a] > dt[b]; }
int main() {
  cin >> n;
  for (int i = 3; i <= n; i++) {
    cout << "1 1 2 " << i << endl;
    cin >> dt[i];
    cout << "2 1 2 " << i << endl;
    cin >> tmp;
    if (tmp == 1) {
      up.push_back(i);
    } else {
      down.push_back(i);
    }
  }
  long long mx_up = 0, luu_up = -1;
  if (up.size() > 0) {
    for (int i : up) {
      if (dt[i] > mx_up) {
        mx_up = dt[i];
        luu_up = i;
      }
    }
    for (int i : up) {
      if (i != luu_up) {
        cout << "2 1 " << luu_up << " " << i << endl;
        cin >> tmp;
        if (tmp == 1) {
          upL.push_back(i);
        } else {
          upR.push_back(i);
        }
      }
    }
    if (upL.size()) sort(upL.begin(), upL.end(), cmp2);
    if (upR.size()) sort(upR.begin(), upR.end(), cmp1);
  }
  long long mx_down = 0, luu_down = -1;
  if (down.size() > 0) {
    for (int i : down) {
      if (dt[i] > mx_down) {
        mx_down = dt[i];
        luu_down = i;
      }
    }
    for (int i : down) {
      if (i != luu_down) {
        cout << "2 2 " << luu_down << " " << i << endl;
        cin >> tmp;
        if (tmp == 1) {
          downL.push_back(i);
        } else {
          downR.push_back(i);
        }
      }
    }
    if (downL.size()) sort(downL.begin(), downL.end(), cmp2);
    if (downR.size()) sort(downR.begin(), downR.end(), cmp1);
  }
  cout << "0 1 ";
  if (downR.size())
    for (int i : downR) cout << i << " ";
  if (luu_down != -1) cout << luu_down << " ";
  if (downL.size())
    for (int i : downL) cout << i << " ";
  cout << "2 ";
  if (upR.size())
    for (int i : upR) cout << i << " ";
  if (luu_up != -1) cout << luu_up << " ";
  if (upL.size())
    for (int i : upL) cout << i << " ";
  cout << endl;
}
