#include <iostream>
#include <vector>

using namespace std;

vector <int> p;

int main()
{
    int n, x = 1, y = 3, k = 1;
    bool a, s;
    cin >> n;
    p.resize(n);

    s = 0;
    if(n)
    {
        do
        {
            if(y > n)
                y = n;
            cout << 1 << ' ' << x << ' ' << y << '\n';
            cout.flush();
            cin >> a;
            if(!s){
                if(a){
                    if(y+2 >= n)
                        y += 1;
                    else
                        y += 2;
                }
                else
                {
                    s = 1;
                    y -= 1;
                }
            }
            else{
                s = 0;
                if(a)
                {
                    p[k] = x;
                    ++k;
                    x = y+1;
                    if(y+3 >= n)
                        y += 2;
                    else
                        y += 3;
                }
                else
                {
                    p[k] = x;
                    ++k;
                    x = y;
                    if(y+2 > n)
                        y += 1;
                    else
                        y += 2;
                }
            }
        }while(!(y > n));

        p[k] = x;
        cout << 2 << ' ' << k << ' ';
        for(int i = 1; i <= k; ++i)
            cout << p[i] << ' ';
        cout << '\n';
        cout.flush();
    }
    else
    {
        cout << 2 << ' ' << 0 << '\n';
        cout.flush();
    }
    return 0;
}