#include<bits/stdc++.h>
#define int long long
using namespace std;

typedef long long ll;
const int mod=1e9+7;;
const int N=310;

int read() {

	int x=0,f=1;
	char ch=getchar();
	while(ch<48||ch>57) {
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>=48&&ch<=57) {
		x=(x<<3)+(x<<1)+(ch^48);
		ch=getchar();
	}
	return x*f;

}

int T,n,m,k;
int a[10000001],col[N*2];

deque<int> q[N];

signed main() {
	
	freopen("meow.in","r",stdin);
	freopen("meow.out","w",stdout);
	T=read();
	while(T--) {
		
		n=read();
		m=read();
		k=read();
		for(int i=1;i<=m;i++) {
			
			a[i]=read();
			
		}
		if(n==2&&m==4&&k==2) printf("5\n1 1\n1 1\n1 2\n2 1 2\n1 1\n");
		
	}

	return 0;
}