#include <bits/stdc++.h>

using namespace std;

int N;
vector<int> buses;

bool f(int x, int y) {
	cout << 1 << ' ' << x << ' ' << y << '\n';
	cout.flush();
	int res;
	cin >> res;
	return res;
}

int main() {
	// assert(freopen("lumber_bus.in", "r", stdin));
	// assert(freopen("lumber_bus.out", "w", stdout));
	cin.sync_with_stdio(false);

	cin >> N;
	buses.push_back(1);
	int i = 1;
	while (i + 1 <= N) {
		if (!f(i, i + 1)) {
			buses.push_back(i + 1);
			i++;
		} else {
			int step = 1;
			while (i + 2 * step <= N && f(i, i + 2 * step)) {
				step <<= 1;
			}

			// f(i, i + step) = true
			int st = i + step + 1;
			int dr = min(N, i + 2 * step);
			int m;
			int best = i + step;
			while (st <= dr) {
				m = (st + dr) / 2;
				if (f(i, m)) {
					best = m;
					st = m + 1;
				} else {
					dr = m - 1;
				}
			}
			i = best + 1;
			if (i <= N) {
				buses.push_back(i);
			}
		}
	}

	int k = (int) buses.size();
	cout << 2 << ' ' << k;
	for (int b : buses) {
		cout << ' ' << b;
	}
	cout << '\n';
	cout.flush();

	return 0;
}