#include <bits/stdc++.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int MAX = 1e3 + 5;
const long long MAX2 = 11;
const long long MOD = 1000000007;
const long long MOD2 = 2010405347;
const long long INF = 2e18;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1, 0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 555;
int n, lw, x, mx;
long long res[MAX];
vector<pair<long long, long long> > a, b;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  lw = 2;
  for (long long i = 3; i <= n; ++i) {
    cout << "2 1 " << lw << ' ' << i << endl;
    cin >> x;
    if (x == -1) lw = i;
  }
  for (long long i = 2; i <= n; ++i)
    if (i != lw) {
      cout << "1 1 " << lw << ' ' << i << endl;
      cin >> res[i];
      if (res[i] > res[mx]) mx = i;
    }
  for (long long i = 2; i <= n; ++i)
    if (i != lw && i != mx) {
      cout << "2 1 " << mx << ' ' << i << endl;
      cin >> x;
      if (x == -1)
        a.push_back({res[i], i});
      else
        b.push_back({res[i], i});
    }
  sort(a.begin(), a.end()), sort(b.begin(), b.end()),
      reverse(b.begin(), b.end());
  cout << "0 1 " << lw;
  for (pair<long long, long long> i : a) cout << ' ' << i.second;
  cout << ' ' << mx;
  for (pair<long long, long long> i : b) cout << ' ' << i.second;
  cout << endl;
  return 0;
}
