#include <bits/stdc++.h>
using namespace std;
struct Node {
	int opt, x, y;
};
queue <Node> q;
int top[305], bot[305];
int main () {
	freopen("meow.in", "r", stdin);
	freopen("meow.out", "w", stdout);
	int T;
	scanf("%d", &T);
	while (T--) {
		memset(top, 0, sizeof(top));
		memset(bot, 0, sizeof(bot));
		int n, m, k;
		scanf("%d%d%d", &n, &m, &k);
		while (m--) {
			int x;
			scanf("%d", &x);
			int id = (x + 1) / 2;
			if (!top[id]) {
				q.push((Node){1, id, 0});
				top[id] = bot[id] = x;
			}else if (top[id] == x) {
				q.push((Node){1, id, 0});
				if (bot[id] == top[id]) {
					bot[id] = top[id] = 0;
				}else {
					top[id] = bot[id];
				}
			}else if (bot[id] == x) {
				q.push((Node){1, n, 0});
				q.push((Node){2, id, n});
				bot[id] = top[id];
			}else {
				q.push((Node){1, id, 1});
				top[id] = x;
			}
		}
		printf("%d\n", q.size());
		while (!q.empty()) {
			Node t = q.front();
			q.pop();
			printf("%d %d", t.opt, t.x);
			if (t.opt == 2) {
				printf(" %d", t.y);
			}
			putchar('\n');
		}
	}
	return 0;
}
