#include<bits/stdc++.h>
using namespace std;
int n,m,k,op,r,a[2000005],b[2000005],c[305];
void solve()
{
	scanf("%d%d%d",&n,&m,&k);
	for (int i=1;i<=m;i++) scanf("%d",&a[i]);
	r=0;b[1]=0;op=0;
	memset(c,0,sizeof(c));
	for (int i=1;i<=m;i++)
	{
		if (a[i]<=n-1) op++,c[a[i]]++;
		else
		{
			if (a[i]==b[1])
			{
				bool o=false;
				for (int j=1;j<=n-1;j++)
				{
					if (c[j]%2==0)
					{
						op+=2;
						o=true;
						break;
					}
				}
				if (o) continue;
			}
			b[++r]=a[i];
			op++;
		}
	}
	printf("%d\n",op);
	r=0;b[1]=0;op=0;
	memset(c,0,sizeof(c));
	for (int i=1;i<=m;i++)
	{
		if (a[i]<=n-1) printf("1 %d\n",a[i]),c[a[i]]++;
		else
		{
			if (a[i]==b[1])
			{
				bool o=false;
				for (int j=1;j<=n-1;j++)
				{
					if (c[j]%2==0)
					{
						printf("1 %d\n",j);
						printf("2 %d %d\n",j,n);
						o=true;
						break;
					}
				}
				if (o) continue;
			}
			b[++r]=a[i];
			printf("1 %d\n",n);
		}
	}
	return ;
}
int main ()
{
    freopen("meow.in","r",stdin);
	freopen("meow.out","w",stdout);
	int T;scanf("%d",&T);
	while (T--) solve();
	return 0;
}
