#include <bits/stdc++.h>
using namespace std;
const int maxn = 320;
const int maxm = 1e5 + 10;
typedef long long ll;
inline int read()	{
	int fw = 1, x = 0;
	char c = getchar();
	while (c < '0' || c > '9')	{
		if (c == '-')	fw = -1;
		c = getchar();
	}
	while (c >= '0' && c <= '9')	{
		x = (x << 1) + (x << 3) + c - '0';
		c = getchar();
	}
	return fw * x;
}
int f[320][2], id = 0, oper[maxm][3], a[maxm], cnt[maxn], pos[maxn], lst[maxn];
int yq[maxm];
void solve()	{
	memset(f, 0, sizeof(f));
	memset(cnt, 0, sizeof(cnt));
	int n = read(), m = read(), k = read();
	if (k == 2 * n - 2)	{
		while (m--)	{
			int x = read(), t = (x + 1) / 2;
			if (f[t][0] == x)	{
				oper[++id][0] = 1, oper[id][1] = n;
				oper[++id][0] = 2, oper[id][1] = t, oper[id][2] = n; 
				f[t][0] = f[t][1], f[t][1] = 0;
			}	else	{
				oper[++id][0] = 1, oper[id][1] = t;
				if (f[t][1] == x)	f[t][1] = 0;
				else if (f[t][0] == 0)	f[t][0] = x;
				else	f[t][1] = x;
			}
		}
		printf("%d\n", id);
		for (int i = 1; i <= id; i++)	{
			if (oper[i][0] == 1)	printf("1 %d\n", oper[i][1]);
			else	printf("2 %d %d\n", oper[i][1], oper[i][2]);
		}
	}	else	{
		;
	}
}
int main()	{
	freopen("meow.in", "r", stdin);
	freopen("meow.out", "w", stdout);
	int T = read();
	while (T--)	{
		solve();
	}
	return 0;
}