#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long a;
  cin >> n;
  pair<long long, int> mv[n];
  int si[n];
  int s;
  for (int i = 3; i <= n; i++) {
    cout << "1 1 2 " << i << endl;
    cout.flush();
    cin >> mv[i - 3].first;
    cout << "2 1 2 " << i << endl;
    cout.flush();
    cin >> s;
    if (s < 0) mv[i - 3].first = -mv[i - 3].first;
    mv[i - 3].second = i;
  }
  sort(mv, mv + (n - 2));
  for (int i = 0; i < n - 2; i++) {
    if (i && mv[i].first < 0) {
      cout << "2 1 " << mv[0].second << ' ' << mv[i].second << endl;
      cout.flush();
      cin >> si[i];
    } else if (i < n - 3 && mv[i].first > 0) {
      cout << "2 1 " << mv[n - 3].second << ' ' << mv[i].second << endl;
      cout.flush();
      cin >> si[i];
    }
  }
  cout << "0 1";
  for (int i = n - 2; i >= 1; i--)
    if (mv[i].first < 0 && si[i] < 0) cout << ' ' << mv[i].second;
  if (mv[0].first < 0) cout << ' ' << mv[0].second;
  for (int i = 1; i < n - 2; i++)
    if (mv[i].first < 0 && si[i] > 0) cout << ' ' << mv[i].second;
  cout << " 2";
  for (int i = 0; i < n - 3; i++)
    if (mv[i].first > 0 && si[i] < 0) cout << ' ' << mv[i].second;
  if (mv[n - 3].first > 0) cout << ' ' << mv[n - 3].second;
  for (int i = n - 4; i >= 0; i--)
    if (mv[i].first > 0 && si[i] > 0) cout << ' ' << mv[i].second;
  cout << endl;
  cout.flush();
  return 0;
}
