#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define lson (u<<1)
#define rson (u<<1|1)
LL read() {
	LL x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9') {
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') {
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}

int t;

#define MAXN 302
#define MAXK 662
int n,m,k;
inline int getB(int x) {
	return (x-1)/2+1;
}
int a[2000002];
int st[MAXN][MAXN],top[MAXN],but[MAXN];
inline void work() {
	n=read(),m=read(),k=read();
	for(int i=1; i<=n; i++)top[i]=0,but[i]=1;
	for(int i=1; i<=m; i++)a[i]=read();
	for(int i=1; i<=m; i++) {
		int bu=getB(a[i]);
		if(st[bu][top[bu]]==a[i]) {
			top[bu]--;
			printf("1 %d\n",bu);
		} else if(st[bu][but[bu]]==a[i]) {
			but[bu]++;
			printf("1 %d\n",n);
			printf("2 %d %d\n",n,bu);
		} else {
			st[bu][++top[bu]]=a[i];
			printf("1 %d\n",bu);
		}
	}
}

int main() {
	freopen("meow.in","r",stdin);
	freopen("meow.out","w",stdout);
	t=read();
	while(t--)work();
}
