#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<long long, int>> v[2];
deque<int> q;
vector<int> ans = {0, 1};
long long get(int a, int b, int c, int d) {
  printf("%d %d %d %d\n", a, b, c, d);
  fflush(stdout);
  long long re;
  scanf("%lld", &re);
  if (a == 2) return -re;
  return re;
}
int main() {
  scanf("%d", &n);
  for (int i = 3; i <= n; i++)
    v[get(2, 1, 2, i) == -1].emplace_back(get(1, 1, 2, i), i);
  if (!v[0].empty()) {
    sort(v[0].begin(), v[0].end());
    q.push_back(v[0].back().second);
    for (int i = (int)v[0].size() - 2; i >= 0; i--)
      if (get(2, 1, v[0].back().second, v[0][i].second) == -1)
        q.push_back(v[0][i].second);
      else
        q.push_front(v[0][i].second);
    while (!q.empty()) {
      ans.push_back(q.front());
      q.pop_front();
    }
  }
  ans.push_back(2);
  if (!v[1].empty()) {
    sort(v[1].begin(), v[1].end());
    q.push_back(v[1].back().second);
    for (int i = (int)v[1].size() - 2; i >= 0; i--)
      if (get(2, 1, v[1].back().second, v[1][i].second) == -1)
        q.push_back(v[1][i].second);
      else
        q.push_front(v[1][i].second);
    while (!q.empty()) {
      ans.push_back(q.front());
      q.pop_front();
    }
  }
  for (int i = 0; i < ans.size(); i++)
    printf("%d%c", ans[i], " \n"[i == ans.size() - 1]);
  fflush(stdout);
}
