#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 55;
vector<pair<long long, long long> > vec;
vector<long long> a;
vector<long long> b;
int main() {
  long long n;
  cin >> n;
  long long mn = 2;
  long long fuck;
  for (long long i = 3; i <= n; i++) {
    cout << 2 << ' ' << 1 << ' ' << mn << ' ' << i << endl;
    cin >> fuck;
    if (fuck < 0) mn = i;
  }
  for (long long i = 2; i <= n; i++) {
    if (i == mn) continue;
    cout << 1 << ' ' << 1 << ' ' << mn << ' ' << i << endl;
    cin >> fuck;
    vec.push_back({fuck, i});
  }
  sort(vec.begin(), vec.end());
  long long m = vec.size();
  m--;
  for (long long i = 0; i < m; i++) {
    cout << 2 << ' ' << 1 << ' ' << vec[m].second << ' ' << vec[i].second
         << endl;
    cin >> fuck;
    if (fuck < 0)
      a.push_back(vec[i].second);
    else
      b.push_back(vec[i].second);
  }
  cout << "0 1 " << mn;
  for (auto x : a) cout << ' ' << x;
  cout << ' ' << vec[m].second;
  reverse(b.begin(), b.end());
  for (auto x : b) cout << ' ' << x;
  cout << endl;
}
