#include <bits/stdc++.h>
using namespace std;
long long kanan[1005], kiri[1005], luaskanan[1005], luaskiri[1005], maxl, maxr,
    maks, jawaban, ki, ka, ki1, ka1;
int n, r, l;
pair<long long, long long> Kiri[1005];
pair<long long, long long> Kanan[1005];
pair<long long, long long> Kiri1[1005];
pair<long long, long long> Kanan1[1005];
int main() {
  cin >> n;
  for (int i = 3; i <= n; i++) {
    cout << "2 1 2 " << i << endl;
    cin >> jawaban;
    if (jawaban < 0) {
      kanan[r] = i;
      r++;
    } else {
      kiri[l] = i;
      l++;
    }
  }
  maks = 0;
  for (int i = 0; i < l; i++) {
    cout << "1 1 2 " << kiri[i] << endl;
    cin >> luaskiri[i];
    if (maks < luaskiri[i]) {
      maks = luaskiri[i];
      maxl = kiri[i];
    }
  }
  maks = 0;
  for (int i = 0; i < r; i++) {
    cout << "1 1 2 " << kanan[i] << endl;
    cin >> luaskanan[i];
    if (maks < luaskanan[i]) {
      maks = luaskanan[i];
      maxr = kanan[i];
    }
  }
  for (int i = 0; i < l; i++) {
    if (kiri[i] == maxl) {
      continue;
    }
    cout << "2 1 " << maxl << " " << kiri[i] << endl;
    cin >> jawaban;
    if (jawaban < 0) {
      Kiri1[ki1].first = luaskiri[i];
      Kiri1[ki1].second = kiri[i];
      ki1++;
    } else {
      Kiri[ki].first = luaskiri[i] * -1;
      Kiri[ki].second = kiri[i];
      ki++;
    }
  }
  for (int i = 0; i < r; i++) {
    if (kanan[i] == maxr) {
      continue;
    }
    cout << "2 1 " << maxr << " " << kanan[i] << endl;
    cin >> jawaban;
    if (jawaban < 0) {
      Kanan1[ka1].first = luaskanan[i];
      Kanan1[ka1].second = kanan[i];
      ka1++;
    } else {
      Kanan[ka].first = luaskanan[i] * -1;
      Kanan[ka].second = kanan[i];
      ka++;
    }
  }
  sort(Kiri, Kiri + ki);
  sort(Kanan, Kanan + ka);
  sort(Kiri1, Kiri1 + ki1);
  sort(Kanan1, Kanan1 + ka1);
  cout << 0 << " ";
  cout << 1;
  n--;
  if (n > 0) cout << " ";
  for (int i = 0; i < ka1; i++) {
    cout << Kanan1[i].second;
    n--;
    if (n > 0) cout << " ";
  }
  if (r > 0) {
    cout << maxr;
    n--;
    if (n > 0) cout << " ";
  }
  for (int i = 0; i < ka; i++) {
    cout << Kanan[i].second;
    n--;
    if (n > 0) cout << " ";
  }
  cout << 2;
  n--;
  if (n > 0) cout << " ";
  for (int i = 0; i < ki1; i++) {
    cout << Kiri1[i].second;
    n--;
    if (n > 0) cout << " ";
  }
  if (l > 0) {
    cout << maxl;
    n--;
    if (n > 0) cout << " ";
  }
  for (int i = 0; i < ki; i++) {
    cout << Kiri[i].second;
    n--;
    if (n > 0) cout << " ";
  }
  cout << endl;
}
