#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int n;

vector<int> sol;

int poz = 1;

int cauta() {
    int ans = poz;
    int b = 0;
    for(b = 0; poz + (1 << b) <= n; b++) {
        cout << "1 " << poz << " " << poz + (1 << b) << '\n';
        cout.flush();
        bool good;
        cin >> good;
        if(!good) {
            break;
        }
    }
    if(b) {
        ans += (1 << (b - 1));
    }
    for(int p = b - 2; p >= 0; p--) {
        if(ans + (1 << p) <= n) {
            cout << "1 " << poz << " " << ans + (1 << p) << '\n';
            cout.flush();
            bool good;
            cin >> good;
            if(good) {
                ans += (1 << p);
            }
        }
    }

    return ans;
}

int main() {
    cin >> n;
    while(poz <= n) {
        int next = cauta();
        sol.push_back(poz);
        poz = next + 1;
    }

    cout << 2 << ' ' << sol.size() << ' ';
    for(auto it : sol) {
        cout << it << ' ';
    }
    cout << '\n';
    cout.flush();

    return 0;
}