#include <bits/stdc++.h>
using namespace std;

template <typename T>
inline void read(T &f) {
	f = 0; int fu = 0; char c = getchar();
	while (c < '0' || c > '9') {
		if (c == '-') fu = 1;
		c = getchar();
	}
	while (c >= '0' && c <= '9') {
		f = f * 10 + c - '0';
		c = getchar();
	}
	if (fu) f = -f;
}

typedef unsigned long long ull;

#include <Windows.h>

mt19937 rng(GetTickCount());

const int N = 250005;

int a[N], b[N];
int n, q;

int main() {
	freopen("match.in", "w", stdout);
	n = rng() % 5000 + 1; q = 250000;
	printf("0 %d\n", n);
	for (int i = 1; i <= n; i++) a[i] = i;
	shuffle(a + 1, a + n + 1, rng);
	for (int i = 1; i <= n; i++) printf("%d%c", a[i], i == n ? '\n' : ' ');
	shuffle(a + 1, a + n + 1, rng);
	for (int i = 1; i <= n; i++) printf("%d%c", a[i], i == n ? '\n' : ' ');
	printf("%d\n", q);
	for (int i = 1; i <= q; i++) {
		int l = rng() % n + 1, r = rng() % n + 1;
		if (l > r) swap(l, r);
		printf("%d %d\n", l, r);
	}
	return 0;
}