#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long LLINF = 1e18 + 7;
int n;
void fl() { cout.flush(); }
vector<pair<long long, long long> > vec;
int answer[1009];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ;
  long long feedback;
  cin >> n;
  int second = 2;
  for (int i = 3; i <= n; i++) {
    cout << 2 << " " << 1 << " " << second << " " << i << '\n';
    fl();
    cin >> feedback;
    if (feedback < 0) {
      second = i;
    }
  }
  answer[1] = 1;
  answer[2] = second;
  for (int i = 2; i <= n; i++) {
    if (i == second) continue;
    cout << 1 << " " << 1 << " " << second << " " << i << '\n';
    fl();
    cin >> feedback;
    vec.push_back({feedback, i});
  }
  sort(vec.begin(), vec.end());
  int middle = vec.back().second;
  int left = n, right = 3;
  for (int i = 0; i < vec.size() - 1; i++) {
    cout << 2 << " " << 1 << " " << middle << " " << vec[i].second << '\n';
    fl();
    cin >> feedback;
    if (feedback > 0) {
      answer[left--] = vec[i].second;
    } else {
      answer[right++] = vec[i].second;
    }
  }
  answer[right] = vec.back().second;
  cout << 0 << " ";
  for (int i = 1; i <= n; i++) {
    cout << answer[i] << " ";
  }
}
