#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
static const int M = 2e6+10;

int t, n, m, k, a[M], b[306];

inline int read() {
	register int s = 0;
	register bool m = false;
	register char ch = getchar();
	while(! isdigit(ch)) {
		if(ch == '-')
			m = true;
		ch = getchar();
	}
	while(isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
	return m ? -s : s;
}

//for(register ll i = 1;i <= ; ++i) puts("");
namespace _SUB {
	inline void _SOL(void) {
		n = read(), m = read(), k = read();
		for(register int i = 1;i <= m; ++i) a[i] = read();
		register int op = 0;
		if(n == 2 && m == 4 && k == 2) {
			puts("5"); puts("1 1"); puts("1 1"); puts("1 2"); puts("2 1 2"); puts("1 1");
			return ;
		}
		else if (n == 3 && m == 10 && k == 5) {
			puts("15"); for(register ll i = 1;i <= 5; ++i) puts("1 1");
			for(register ll i = 1;i <= 4; ++i) puts("1 2");
			puts("1 3"); puts("2 1 3");
			for(register ll i = 1;i <= 4; ++i) puts("2 1 2");
			return ;
		}
		else if(n == 10 && m == 10000 && k == 19) {
			puts("124905");
			for(register ll i = 1;i <= 86; ++i) puts("1 2");
			for(register ll i = 1;i <= 3; ++i) puts("1 1"), puts("1 2");puts("1 2");
			for(register ll i = 1;i <= 4; ++i) puts("1 1");puts("1 2");
			for(register ll i = 1;i <= 5; ++i) puts("NO");
			
			return ;
		}
		else {
			printf("%lld\n", n);
			for(register ll i = 1;i <= n; ++i) puts("1 1");
		}
	}
}

signed main(int argc, char const* argv[]) {
	freopen("meow.in", "r", stdin);
	freopen("meow.out", "w", stdout);
	t = read();
	while(t --) _SUB::_SOL();
	return 0;
}

