#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<long long int> points = {1};
  long long int pos2;
  long long int area[1005];
  area[1] = 0;
  area[2] = 0;
  cout << "2 1 2 3" << endl;
  long long int sgn;
  cin >> sgn;
  if (sgn == 1) {
    points.push_back(2);
    points.push_back(3);
    pos2 = 1;
  } else {
    points.push_back(3);
    points.push_back(2);
    pos2 = 2;
  }
  cout << "1 1 2 3" << endl;
  cin >> area[3];
  for (long long int i = 4; i <= n; i++) {
    cout << "2 1 2 " << i << endl;
    cin >> sgn;
    cout << "1 1 2 " << i << endl;
    cin >> area[i];
    long long int point1 = -1, point2 = -1;
    long long int start = (sgn == 1) ? (pos2 + 1) : 1;
    long long int finish = (sgn == 1) ? (i - 1) : pos2;
    if (sgn == -1) pos2++;
    if (start == finish) {
      points.insert(points.begin() + start, i);
      continue;
    }
    long long int maxArea = 0;
    long long int maxInd = 0;
    for (long long int j = start; j < finish; j++) {
      if (point1 == -1 && area[points[j]] >= area[i]) point1 = j;
      if (point1 != -1 && point2 == -1 &&
          (j == finish - 1 || area[points[j + 1]] <= area[i]))
        point2 = j;
      if (maxArea < area[points[j]]) {
        maxArea = area[points[j]];
        maxInd = j;
      }
    }
    if (maxArea < area[i]) {
      cout << "2 1 " << points[maxInd] << " " << i << endl;
      cin >> sgn;
      if (sgn == 1)
        points.insert(points.begin() + maxInd + 1, i);
      else
        points.insert(points.begin() + maxInd, i);
      continue;
    }
    cout << "2 1 " << points[point1] << " " << i << endl;
    cin >> sgn;
    if (sgn < 0)
      points.insert(points.begin() + point1, i);
    else
      points.insert(points.begin() + point2 + 1, i);
  }
  cout << "0 ";
  for (long long int point : points) cout << point << " ";
  return 0;
}
