#include <bits/stdc++.h>
using namespace std;
int n;
long long si;
int ans[1005], m;
struct pl {
  int id, op;
  long long num;
} s[1005];
bool cmp(const pl &A, const pl &B) { return A.num < B.num; }
void find(int a, int b, int c, int d) {
  printf("%d %d %d %d\n", a, b, c, d);
  fflush(stdout);
}
int main() {
  scanf("%d", &n);
  int tmp = 2;
  for (int i = 3; i <= n; i++) {
    find(2, 1, i, tmp);
    scanf("%lld", &si);
    if (si == 1) tmp = i;
  }
  ans[1] = 1;
  ans[2] = tmp;
  for (int i = 2; i <= n; i++) {
    if (i == tmp) continue;
    find(1, 1, tmp, i);
    scanf("%lld", &si);
    m++;
    s[m].id = i;
    s[m].num = si;
  }
  sort(s + 1, s + 1 + m, cmp);
  for (int i = 1; i < m; i++) {
    find(2, 1, s[i].id, s[m].id);
    scanf("%lld", &si);
    s[i].op = si;
  }
  s[m].op = 1;
  int tot = 2;
  for (int i = 1; i <= m; i++)
    if (s[i].op == 1) tot++, ans[tot] = s[i].id;
  for (int i = m; i >= 1; i--)
    if (s[i].op == -1) tot++, ans[tot] = s[i].id;
  printf("0 ");
  for (int i = 1; i <= n; i++) {
    if (i != n)
      printf("%d ", ans[i]);
    else
      printf("%d\n", ans[i]);
  }
  puts("");
  fflush(stdout);
  return 0;
}
