#include <bits/stdc++.h>
using namespace std;
inline int setBit(int mask, int pos) { return (mask | (1 << pos)); }
inline int resetBit(int mask, int pos) { return (mask & ~(1 << pos)); }
inline bool checkBit(int mask, int pos) { return (bool)(mask & (1 << pos)); }
int n;
vector<pair<long long int, int> > vec;
int out[2 * 1005], lp, rp;
bool comp(pair<long long int, int> p1, pair<long long int, int> p2) {
  return (p1.first > p2.first);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int dir;
  long long int area;
  cin >> n;
  out[0] = 1;
  out[1] = 2;
  for (int i = 3; i <= n; i++) {
    cout << "2 1 " << out[1] << " " << i << endl;
    cout.flush();
    cin >> dir;
    if (dir == -1) out[1] = i;
  }
  for (int i = 2; i <= n; i++) {
    if (out[1] == i) continue;
    cout << "1 1 " << out[1] << " " << i << endl;
    cout.flush();
    cin >> area;
    vec.push_back(pair<long long int, int>(area, i));
  }
  sort(vec.begin(), vec.end(), comp);
  lp = n - 1;
  rp = n;
  out[lp--] = vec[0].second;
  for (int i = 1; i < vec.size(); i++) {
    cout << "2 1 " << vec[i - 1].second << " " << vec[i].second << endl;
    cout.flush();
    cin >> dir;
    if (dir == -1)
      out[lp--] = vec[i].second;
    else
      out[rp++] = vec[i].second;
  }
  cout << "0";
  for (int i = 0; i < rp; i++) {
    if (!out[i]) continue;
    cout << " " << out[i];
  }
  cout << endl;
  return 0;
}
