#include <bits/stdc++.h>
using namespace std;
class pnt {
 public:
  int ord;
  long long sqre;
  pnt() = default;
  pnt(const int& _ord, const long long& _sqre) : ord(_ord), sqre(_sqre){};
  bool operator<(const pnt& b) const { return sqre < b.sqre; }
  bool operator>(const pnt& b) const { return sqre > b.sqre; }
};
const int maxn = 1e3 + 7;
int main() {
  int n;
  cin >> n;
  vector<pnt> a[4];
  vector<pnt> up;
  vector<pnt> down;
  for (int i = 3; i <= n; i++) {
    int tmp;
    long long sqre;
    cout << "1 1 2 " << i << endl;
    cin >> sqre;
    cout << "2 1 2 " << i << endl;
    cin >> tmp;
    if (tmp == 1)
      up.push_back(pnt(i, sqre));
    else
      down.push_back(pnt(i, sqre));
  }
  sort(up.begin(), up.end(), greater<pnt>());
  sort(down.begin(), down.end(), greater<pnt>());
  pnt top, bottom;
  if (!up.empty()) {
    top = up[0];
    for (int i = 1; i < up.size(); i++) {
      cout << "2 1 " << top.ord << ' ' << up[i].ord << endl;
      int tmp;
      cin >> tmp;
      if (tmp == 1)
        a[3].push_back(up[i]);
      else
        a[2].push_back(up[i]);
    }
  }
  if (!down.empty()) {
    bottom = down[0];
    for (int i = 1; i < down.size(); i++) {
      cout << "2 1 " << bottom.ord << ' ' << down[i].ord << endl;
      int tmp;
      cin >> tmp;
      if (tmp == 1)
        a[1].push_back(down[i]);
      else
        a[0].push_back(down[i]);
    }
  }
  sort(a[0].begin(), a[0].end(), less<pnt>());
  sort(a[1].begin(), a[1].end(), greater<pnt>());
  sort(a[2].begin(), a[2].end(), less<pnt>());
  sort(a[3].begin(), a[3].end(), greater<pnt>());
  cout << "0 1 ";
  for (auto& p : a[0]) cout << p.ord << ' ';
  if (!down.empty()) cout << bottom.ord << ' ';
  for (auto& p : a[1]) cout << p.ord << ' ';
  cout << "2 ";
  for (auto& p : a[2]) cout << p.ord << ' ';
  if (!up.empty()) cout << top.ord << ' ';
  for (auto& p : a[3]) cout << p.ord << ' ';
  cout << endl;
}
