#include<bits/stdc++.h>
#define For(i,j,k) for(int i=(j);i<=(k);i++)
#define foR(i,j,k) for(int i=(j);i>=(k);i--)
#define mst(a,b) memset(a,b,sizeof(a)); 
#define vi vector<int>
#define mkp make_pair
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
#define pb push_back
using namespace std;
int read() { int x; scanf("%d",&x); return x; }
const int P=998244353; 
int add(int x,int y) { return (x+y)%P; }
int sub(int x,int y) { return (x-y+P)%P; }
int mul(int x,int y) { return 1ull*x*y%P; }
void addmod(int &x,int y) { x=add(x,y); }
void submod(int &x,int y) { x=sub(x,y); }
void mulmod(int &x,int y) { x=mul(x,y); }
void fprint(int *a,int n) {For(i,1,n) fprintf(stderr,"%d%c",a[i]," \n"[i==n]); }
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); 
int Rnd(int l,int r) { return rnd()%(r-l+1)+l; }
const int MN=2e6+5; 
int a[MN],T=1000; 
void works() {
	int n=(T==999||Rnd(0,1))?(Rnd(0,1)?2:300):Rnd(1,6),m=T==999?1000000:Rnd(1,20),t=n*2-1; 
//	int n=1,m=Rnd(1,20),t=n*2-1; 
	cout<<n<<' '<<2*m<<' '<<t<<endl; 
	For(i,1,m) a[i]=Rnd(1,t); 
	For(i,m+1,2*m) a[i]=a[i-m]; 
	shuffle(a+1,a+1+2*m,rnd); 
	For(i,1,2*m) printf("%d ",a[i]);
	printf("\n"); 
}
int main() {
	freopen("meow.in","w",stdout);
	cout<<T<<endl; 
	while(T--) {
		works(); 
	}
	return 0; 
}
