#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#define pii pair<int, int>
#define BASE 5
using namespace std;
int n, bani, last;
vector <int> sol;

inline bool Pos(int st, int dr)
{
    if(st == 0)
        return false;
    int ans;
    cout << "1 " << st << " " << dr << "\n";
    cout.flush();
    cin >> ans;
    return (ans == 1);
}

inline void Solve(int st, int dr)
{
    if(st > dr)
        return;
    if(st == dr)
    {
        if(Pos(last, st) == false)
        {
            sol.push_back(st);
            last = st;
        }
        return;
    }
    if(Pos(st, dr))
    {
        if(Pos(last, dr))
            return;
        sol.push_back(st);
        last = st;
        return;
    }
    int lg = (dr - st + 1) / BASE, rest = (dr - st + 1) % BASE;
    int i = st;
    while(i <= dr)
    {
        if(rest > 0)
        {
            rest--;
            Solve(i, i + lg);
            i += lg + 1;
        }
        else
        {
            Solve(i, i + lg - 1);
            i += lg;
        }
    }
}

int main()
{
    std::ios_base::sync_with_stdio(false);
    cin >> n;
    Solve(1, n);
    cout << "2 " << sol.size() << " ";
    for(int i = 0; i < sol.size(); ++i)
        cout << sol[i] << " ";
    cout << "\n";
    cout.flush();
    return 0;
}