#include <bits/stdc++.h>
using namespace std;
long long dist[1001];
bool cmp(long long a, long long b) { return (dist[a] <= dist[b]); }
bool cmore(long long a, long long b) { return (dist[a] <= dist[b]); }
bool cless(long long a, long long b) { return (dist[a] >= dist[b]); }
void solve(vector<long long> &v) {
  if (v.size() <= 1) return;
  vector<long long> l;
  vector<long long> r;
  for (long long i = 0; i < v.size() - 1; i++) {
    printf("2 1 %lld %lld\n", v[v.size() - 1], v[i]);
    fflush(stdout);
    long long sign;
    scanf("%lld", &sign);
    if (sign > 0)
      l.push_back(v[i]);
    else
      r.push_back(v[i]);
  }
  sort(l.begin(), l.end(), cmore);
  sort(r.begin(), r.end(), cless);
  long long ind = 0;
  for (long long i = 0; i < l.size(); i++, ind++) v[ind] = l[i];
  v[ind] = v[v.size() - 1];
  ind++;
  for (long long i = 0; i < r.size(); i++, ind++) v[ind] = r[i];
}
bool cmpdist(long long a, long long b) { return (dist[a] <= dist[b]); }
int main() {
  long long n;
  scanf("%lld", &n);
  vector<long long> left;
  vector<long long> right;
  for (long long i = 3; i <= n; i++) {
    printf("2 1 2 %lld\n", i);
    fflush(stdout);
    long long sign;
    scanf("%lld", &sign);
    if (sign < 0)
      right.push_back(i);
    else
      left.push_back(i);
  }
  for (long long i = 3; i <= n; i++) {
    printf("1 1 2 %lld\n", i);
    fflush(stdout);
    scanf("%lld", &dist[i]);
  }
  sort(left.begin(), left.end(), cmpdist);
  sort(right.begin(), right.end(), cmpdist);
  solve(left);
  solve(right);
  printf("0 1");
  if (right.size() != 0)
    for (long long i = right.size() - 1; i >= 0; i--) printf(" %lld", right[i]);
  printf(" 2");
  if (left.size() == 0) return 0;
  for (long long i = left.size() - 1; i >= 0; i--) printf(" %lld", left[i]);
}
