#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int Mod=998244353;
const int maxn=2e6+5;
int n,m,k,T;
bool n2;
int a[maxn],b[maxn];
struct Node{
	int a,b,c;
}; 
queue<Node> Q;

void solve2(int num){
	int a1[num];
	a1[0]=0;
	int a1h=1,a1t=1;	//head tail
	Q.push({1,1,0});
	a1[1]=a[1];
	int r=2;
	while(r<=m){
		if(a1t==a1h){
			a[++a1t]=a[++r];
			a1h++;
			Q.push({1,1,0});
		}
		while(a[r]!=a[a1h] && r<=m){
			Q.push({1,1,0});
			while(a[r]==a1[a1t] && a1t>=a1h) {
				a1t--;
				r++;
				if(r>=m) return;
			}
			a1[++a1t]=a[r];
			r++;
			if(r>=m) return;
		} 
		if(r>=m) return;  
		//printf("%d!!\n",r);
		Q.push({1,2,0});
		Q.push({2,1,2});
		a1h++;
		r++;
	}
}

void print(){
	printf("%d\n",Q.size());
	while(!Q.empty()){
		Node ans=Q.front();Q.pop();
		//if(cnt>m) return;
		if(ans.c==0) printf("%d %d\n",ans.a,ans.b);
		else printf("%d %d %d\n",ans.a,ans.b,ans.c);
	}
}

int main()
{
	freopen("meow.in","r",stdin);
	freopen("meow.out","w",stdout);
	//scanf("%d%d",&T,&id);
	scanf("%d",&T);
	if(T==1002) n2=1;
	while(T--){
		while(!Q.empty()) Q.pop();
		scanf("%d%d%d",&n,&m,&k);
		for(int i=1;i<=m;i++){
			scanf("%d",&a[i]);
		} 
		//if(n2) {
			solve2(m/2+3);
			print();
		//}
	} 
	
	return 0;
}
