#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;
}

#include <Windows.h>

const int N = 2e6 + 5;

mt19937 rng(GetTickCount());
int a[N];
int T, n, m, k;

int main() {
	freopen("meow.in", "w", stdout);
	T = 100;
	printf("%d\n", T);
	while (T--) {
		int n = rng() % 300 + 1, m = 10000 * 2, k = n * 2 - 1;
		printf("%d %d %d\n", n, m, k);
		for (int i = 1; i <= m; i += 2) {
			a[i] = a[i + 1] = rng() % k + 1;
		}
		shuffle(a + 1, a + m + 1, rng);
		for (int i = 1; i <= m; i++) printf("%d%c", a[i], i == m ? '\n' : ' ');
	}
	return 0;
}