#include <bits/stdc++.h>
using namespace std;
int n;
struct nod {
  long long dis;
  int id;
  nod(long long a, int b) {
    dis = a;
    id = b;
  }
  nod() {}
} a[2005];
bool operator<(nod a, nod b) { return a.dis < b.dis; }
int top1, top2;
int q1[2005], q2[2005];
int main() {
  int t, p;
  scanf("%d", &n);
  printf("2 %d %d %d\n", 1, 2, 3);
  fflush(stdout);
  scanf("%d", &t);
  if (t > 0)
    p = 2;
  else
    p = 3;
  for (int i = 4; i <= n; i++) {
    printf("2 1 %d %d\n", p, i);
    fflush(stdout);
    scanf("%d", &t);
    if (t < 0) p = i;
  }
  int tot = 0;
  for (int i = 2; i <= n; i++) {
    if (p != i) {
      printf("1 1 %d %d\n", p, i);
      fflush(stdout);
      long long dis;
      scanf("%lld", &dis);
      a[++tot] = nod(dis, i);
    }
  }
  sort(a + 1, a + 1 + tot);
  for (int i = 1; i < tot; i++) {
    printf("2 1 %d %d\n", a[i].id, a[i + 1].id);
    fflush(stdout);
    scanf("%d", &t);
    if (t < 0) {
      q1[++top1] = a[i].id;
    } else
      q2[++top2] = a[i].id;
  }
  printf("0");
  printf(" 1");
  printf(" %d", p);
  for (int i = 1; i <= top2; i++) printf(" %d", q2[i]);
  printf(" %d", a[tot].id);
  for (int i = top1; i >= 1; i--) printf(" %d", q1[i]);
}
