#include<bits/stdc++.h>
#define pb push_back
template<typename _Tp>void read(_Tp &x){
	char ch(getchar());bool f=0;while(!isdigit(ch))f|=ch=='-',ch=getchar();
	x=ch&15,ch=getchar();while(isdigit(ch))x=x*10+(ch&15),ch=getchar();
	if(f)x=-x;
}
std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
int main(){
	int T=1000;printf("%d\n",T);
	while(T--){
		int n=rnd()%5+1,m=(rnd()%2000+1)*2,k=2*n-1;
		printf("%d %d %d\n",n,m,k);
		std::vector<int> p;
		for(int i=1;i<=m/2;++i){
			int x=rnd()%k+1;p.pb(x),p.pb(x);
		}
		std::shuffle(p.begin(),p.end(),rnd);
		for(int i=0;i<m;++i)printf("%d%c",p[i]," \n"[i+1==m]);
	}
	return 0;
}
