#include<bits/stdc++.h>
using namespace std;
#define N 2000006
int n,m,k,T;
stack<int> s1,s2;
int a[N];
int main()
{
	freopen("meow.in","r",stdin);
	freopen("meow.out","w",stdout);
	cin>>T;
	while(T--)
	{
		int bot1,bot2;
		scanf("%d%d%d",&n,&m,&k);
		for(int i=1;i<=m;i++) scanf("%d",&a[i]);
		int s=m/n;
		while(s--) cout<<1<<" "<<n<<endl;
	}
	return 0;
}