#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int maxn = 1050;
int main() {
  int n;
  scanf("%d", &n);
  int A = 1, B = 2, M = 1;
  for (int i = 3; i <= n; ++i) {
    printf("%d %d %d %d\n", 2, A, B, i);
    fflush(stdout);
    int resp;
    scanf("%d", &resp);
    if (resp < 0) B = i;
  }
  vector<long long> area(n + 1);
  vector<int> sign(n + 1);
  for (int i = 2; i <= n; ++i) {
    if (i == B) continue;
    printf("%d %d %d %d\n", 1, A, B, i);
    fflush(stdout);
    scanf("%lld", &area[i]);
    if (area[i] >= area[M]) M = i;
  }
  for (int i = 2; i <= n; ++i) {
    if (i == M) continue;
    printf("%d %d %d %d\n", 2, A, M, i);
    fflush(stdout);
    scanf("%d", &sign[i]);
  }
  sign[M] = 0;
  vector<int> idx(n + 1);
  iota(idx.begin(), idx.end(), 0);
  sort(idx.begin() + 2, idx.end(), [&sign, &area](int i, int j) {
    if (sign[i] != sign[j]) return sign[i] < sign[j];
    return area[i] * sign[i] > area[j] * sign[j];
  });
  for (int i = 0; i <= n; ++i) {
    printf("%d%s", idx[i], i == n ? " " : "\n");
  }
  return 0;
}
