#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=303,M=2000010;
int T,n,m,k;
int a[M],ans;
deque<int>qw[N];
struct Node{
	int a,b,c;
}op[M];
void dfs(int x,int num){
	if(x>m){
		for(int i=1;i<=n;i++){
			if(!qw[i].empty())return;
		}
		ans=num-1;
		return ;
	}
	//cout<<x<<endl;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(qw[i].empty()||qw[j].empty())continue;
			if(qw[i].front()==qw[j].front()){
				int u=qw[i].front();
				qw[i].pop_front();
				qw[j].pop_front();
				op[num].a=2;op[num].b=i;
				op[num].c=j;
				dfs(x,num+1);
				qw[i].push_front(u);
				qw[j].push_front(u);
				if(ans)return;
			}
		}
	}
	for(int i=1;i<=n;i++){
		op[num].a=1;op[num].b=i;
		qw[i].push_back(a[x]);
		int fg=0;
		if(qw[i].size()>=2&&qw[i].front()==qw[i].back()){
			fg=1;
			qw[i].pop_back();qw[i].pop_back();
		}
		dfs(x+1,num+1);
		if(fg){
			qw[i].push_back(a[x]);
		}
		else qw[i].pop_back();
		if(ans)return;
	}
}
int main(){
	freopen("meow.in","r",stdin);
	freopen("meow.out","w",stdout);
	scanf("%d",&T);
	while(T--){
		ans=0;
		scanf("%d%d%d",&n,&m,&k);
		for(int i=1;i<=m;i++){
			scanf("%d",&a[i]);
		}
		dfs(1,1);
		printf("%d\n",ans);
		for(int i=1;i<=ans;i++){
			if(op[i].a==1){
				printf("%d %d\n",1,op[i].b);
			}else printf("%d %d %d\n",2,op[i].b,op[i].c);
		}
	}
	return 0;
}
