#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream& operator<<(ostream& out, pair<T, U>& o) {
  out << "(" << o.first << ", " << o.second << ") ";
  return out;
}
template <class Int>
ostream& operator<<(ostream& out, vector<Int>& o) {
  for (auto it : o) out << it << " ";
  return out;
}
template <class Int>
istream& operator>>(istream& in, vector<Int>& i) {
  for (auto& it : i) in >> it;
  return in;
}
template <class T>
ostream& print(T&& t) {
  return cout << t << endl;
}
template <class T, class... Args>
ostream& print(T&& t, Args&&... args) {
  cout << t << ' ';
  return print(args...);
}
template <class... Args>
istream& read(Args&... args) {
  return (cin >> ... >> args);
}
using ll = long long;
using Pair = pair<ll, ll>;
int main() {
  int n;
  read(n);
  int near = 2;
  for (int i = 3; i <= n; ++i) {
    print(2, 1, near, i);
    int sign;
    read(sign);
    if (sign == 1) near = i;
  }
  vector<ll> area(n + 1, 0);
  for (int i = 2; i <= n; ++i)
    if (i != near) {
      print(1, 1, near, i);
      ll A;
      read(A);
      area[i] = A;
    }
  ll maxIdx = 2;
  for (int i = 2; i <= n; ++i)
    if (area[maxIdx] < area[i]) maxIdx = i;
  vector<Pair> left, right;
  for (int i = 2; i <= n; ++i)
    if (i != near && i != maxIdx) {
      print(2, 1, maxIdx, i);
      int sign;
      read(sign);
      Pair t(area[i], i);
      if (sign == 1)
        left.push_back(t);
      else
        right.push_back(t);
    }
  sort(left.begin(), left.end());
  sort(right.begin(), right.end());
  reverse(left.begin(), left.end());
  vector<int> ans(1, 0);
  ans.push_back(1);
  for (auto& [v, i] : right) ans.push_back(i);
  ans.push_back(maxIdx);
  for (auto& [v, i] : left) ans.push_back(i);
  ans.push_back(near);
  print(ans);
}
