#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ll long long
#define pii pair<int,int>
#define tii tuple <int,int,int>
#define N 200005
#define mod 1000000005
#define X first
#define Y second
#define eps 0.0000000001
#define all(x) x.begin(),x.end()
#define tot(x) x+1,x+n+1
using namespace std;

int n, pp, x, y, m, ok, xx;
vector<int>v;

int main() {
    cin.sync_with_stdio(0);
    cout.sync_with_stdio(0);
    cin >> n;
    pp = 1;
    x = 1;
    y = n;

    while(1) {
        x = pp;
        y = n;
        xx = x;

        while(x <= y) {
            m = (x + y) / 2;
            ok = 0;

            if(m == pp)
                ok = 1;
            else {
                cout << 1 << ' ' << pp << ' ' << m << '\n';
                cout.flush();
                cin >> ok;
            }

            if(ok) {
                xx = m;
                x = m + 1 ;
            }
            else
                y = m - 1 ;
        }

        v.pb(pp);
        pp = xx + 1;

        if(xx >= n)
            break;
    }

    cout << 2 << ' ' << v.size() << ' ';

    for(auto it : v)
        cout << it << ' ' ;

    cout.flush();
    return 0;
}