#include<bits/stdc++.h>
using namespace std;
int t,n,m,k;
vector<int>oper;
int main()
{
	freopen("meow.in","r",stdin);
	freopen("meow.out","w",stdout);
	cin>>t;
	while(t--)
	{
		cin>>n>>m>>k;
		while(m--)
		{
			int x;
			cin>>x;
			oper.push_back(x);
		}
		cout<<oper.size()<<endl;
		for(int i=0;i<oper.size();i++)
		{
			cout<<"1 "<<oper[i]<<endl;
		}
		oper.clear();
	}
	return 0;
}