#include <bits/stdc++.h>
using namespace std;
const long long int M = 1e9 + 7;
struct something {
  int index;
  int position;
  long long int area;
};
int n;
vector<something> posi, nega;
int posiLength = -1, negaLength = -1;
bool comp(something x, something y) { return x.area > y.area; }
int main() {
  cin >> n;
  for (int i = 3; i <= n; i++) {
    int temp;
    cout << "2 2 1 " << i << endl;
    cin >> temp;
    if (temp > 0) {
      posiLength++;
      posi.push_back(something());
      posi[posiLength].index = i;
      cout << "1 2 1 " << i << endl;
      cin >> posi[posiLength].area;
    } else {
      negaLength++;
      nega.push_back(something());
      nega[negaLength].index = i;
      cout << "1 2 1 " << i << endl;
      cin >> nega[negaLength].area;
    }
  }
  sort(posi.begin(), posi.end(), comp);
  sort(nega.begin(), nega.end(), comp);
  for (int i = 1; i <= posiLength; i++) {
    cout << "2 2 " << posi[0].index << " " << posi[i].index << endl;
    cin >> posi[i].position;
  }
  for (int i = 1; i <= negaLength; i++) {
    cout << "2 2 " << nega[0].index << " " << nega[i].index << endl;
    cin >> nega[i].position;
  }
  cout << "0 1 ";
  for (int i = posiLength; i > 0; i--) {
    if (posi[i].position == 1) continue;
    cout << posi[i].index << " ";
  }
  for (int i = 0; i <= posiLength; i++) {
    if (posi[i].position == -1) continue;
    cout << posi[i].index << " ";
  }
  cout << "2";
  for (int i = negaLength; i > 0; i--) {
    if (nega[i].position == 1) continue;
    cout << " " << nega[i].index;
  }
  for (int i = 0; i <= negaLength; i++) {
    if (nega[i].position == -1) continue;
    cout << " " << nega[i].index;
  }
  cout << endl;
}
