#include <bits/stdc++.h>
using namespace std;
long long int n, a, b, signo, dist, centro;
vector<pair<long long int, long long int> > distancias;
vector<long long int> izq, der;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  a = 1;
  b = 2;
  for (int i = (3); i <= (n); i++) {
    cout << "2 " << a << " " << b << " " << i << endl;
    cin >> signo;
    if (signo > 0) b = i;
  }
  for (int i = (1); i <= (n); i++) {
    if (i == a || i == b) continue;
    cout << "1 " << a << " " << b << " " << i << endl;
    cin >> dist;
    distancias.push_back({-dist, i});
  }
  sort(distancias.begin(), distancias.end());
  centro = 0;
  for (auto d : distancias) {
    if (centro == 0) {
      centro = d.second;
      continue;
    }
    cout << "2 " << a << " " << centro << " " << d.second << endl;
    cin >> signo;
    if (signo > 0)
      izq.push_back(d.second);
    else
      der.push_back(d.second);
  }
  reverse(der.begin(), der.end());
  cout << "0 " << a << " ";
  for (auto n : der) cout << n << " ";
  cout << centro << " ";
  for (auto n : izq) cout << n << " ";
  cout << b << endl;
  return 0;
}
