#include <bits/stdc++.h>

using namespace std;

const int NMax = 1e5 + 5;

vector < int > v;

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("debug.in", "r", stdin);
    #endif // ONLINE_JUDGE*/

    //freopen("a.in", "r", stdin);

    int n, lo, exp, lim, x, a, b, mid, best;
    cin >> n;
    bool stop = 0;
    lo = 1;
    while(lo < n && !stop){
        v.push_back(lo);
        exp = 10;
        lim = min(lo + exp, n);
        cout << 1 << " " << lo << " " << lim;
        cout.flush();
        while(cin >> x && x){
            if(exp >= lim){
                lo = INFINITY;
                stop = 1;
                break;
            }
            exp *= 10;
            lim = min(lo + exp, n);
            cout << 1 << " " << lo << " " << lim;
            cout.flush();
        }
        if(!stop){
            a = lo + lim / 10 + 1;
            b = lim;
            best = a - 1;
            while(a <= b){
                mid = (a + b) >> 1;
                cout << 1 << " " << lo << " " << mid;
                cout.flush();
                if(cin >> x && x){
                    a = mid + 1;
                    best = mid;
                } else {
                    b = mid - 1;
                }
            }
            lo = best + 1;
        }
    }
    if(lo == n){
        v.push_back(n);
    }
    cout << 2 << " " << (int)v.size() << " ";
    for(auto it: v){
        cout << it << " ";
    }
    cout.flush();
    return 0;
}