#include <bits/stdc++.h>
using namespace std;
constexpr int max_n=300;
bool fl[max_n*2];
vector<int>a;
void test(){
	int n=/*rand()%300+1*/300,m=/*(rand()%50000+1)*2*/200000;
	const int k=n*2-1;
	printf("%d %d %d\n",n,m,k);
	for(int i=1; i<=n; ++i)
		fl[i]=0;
	a.clear();
	for(int i=m/2; i; --i){
		const int v=rand()%k+1;
		a.emplace_back(v);
		a.emplace_back(v);
	}
	random_shuffle(a.begin(),a.end());
	for(int i=0; i<m; ++i)
		printf("%d ",a[i]);
	puts("");
}
int main(){
	int t=10;
	printf("%d\n",t);
	for(; t; test(),--t);
	return 0;
}