#include <iostream>
#include <cstdio>

using namespace std;

#define DIM 100005

int x, y;

int Sol[DIM];

int main() {
    int N;

    cin >> N;

    if(N == 1) {
        cout << "2 1\n";
        return 0;
    }

    int x = 1;

    while(x <= N) {
        int in = x, sf = N;

        while(in <= sf) {
            y = (in + sf) / 2;

            cout << 1 << ' ' << x << ' ' << y << '\n';
            cout.flush();

            int sepoate;

            cin >> sepoate;

            if(sepoate) {
                in = y + 1;
            }
            else {
                sf = y - 1;
            }
        }

        Sol[++Sol[0]] = x;
        x = sf + 1;
    }

    cout << 2 << ' ' << Sol[0] << ' ';

    for(int i = 1; i <= Sol[0]; ++i) {
        cout << Sol[i] << ' ';
    }

    cout << '\n';

    return 0;
}