#include <bits/stdc++.h>

using namespace std;

int a[100010];

bool ask(int xx, int yy) {
    cout << 1 << " " << xx << " " << yy;
    cout << "\n";
    cout.flush();
    int pl;
    cin >> pl;
    return pl;
}

int main() {
    int n;
    cin >> n;
    int i = 1;
    while (i <= n) {
        int right = n;
        int res;
        int left = i;
        while (left <= right) {
            int med = (left + right) / 2;
            if (ask(i, med)) {
                left = med + 1;
                res = med;
            } else
                right = med - 1;
        }
        a[++a[0]] = i;
        i = res + 1;
    }
    for (int i = 0; i <= a[0]; ++i)
        cout << a[i] << " ";
    cout.flush();
}