#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  int n, x = 0, y = 0;
  long long a[1003] = {}, b[1003] = {};
  vector<pair<long long, int>> c, d, e, f;
  cin >> n;
  for (int i = 3; i <= n; i++) {
    cout << 1 << ' ' << 1 << ' ' << 2 << ' ' << i << endl;
    cin >> a[i];
  }
  for (int i = 3; i <= n; i++) {
    cout << 2 << ' ' << 1 << ' ' << 2 << ' ' << i << endl;
    cin >> b[i];
  }
  for (int i = 3; i <= n; i++) {
    if (b[i] == -1) {
      if (a[i] > a[x]) x = i;
    } else {
      if (a[i] > a[y]) y = i;
    }
  }
  if (x)
    for (int i = 3; i <= n; i++)
      if (b[i] == -1 && i != x) {
        cout << 2 << ' ' << 1 << ' ' << x << ' ' << i << endl;
        long long w;
        cin >> w;
        if (w == -1)
          c.push_back({a[i], i});
        else
          d.push_back({-a[i], i});
      }
  if (y)
    for (int i = 3; i <= n; i++)
      if (b[i] == 1 && i != y) {
        cout << 2 << ' ' << 1 << ' ' << y << ' ' << i << endl;
        long long w;
        cin >> w;
        if (w == -1)
          e.push_back({a[i], i});
        else
          f.push_back({-a[i], i});
      }
  sort(c.begin(), c.end());
  sort(d.begin(), d.end());
  sort(e.begin(), e.end());
  sort(f.begin(), f.end());
  cout << 0 << ' ';
  cout << 1 << ' ';
  for (auto i : c) cout << i.second << ' ';
  if (x) cout << x << ' ';
  for (auto i : d) cout << i.second << ' ';
  cout << 2 << ' ';
  for (auto i : e) cout << i.second << ' ';
  if (y) cout << y << ' ';
  for (auto i : f) cout << i.second << ' ';
  cout << endl;
}
