#include<bits/stdc++.h>
//define kkks03 my love
//define (WO DUI KKK DE LOVE YUAN DUO YU WO DUI C C F DE LOVE)  (ZHEN LI)
using namespace std;
int n,m,t,k;
int a[300];
int main(){
	freopen("meow.in","r",stdin);
	freopen("meow.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>t;
	for(int kkks03=1;kkks03<=t;kkks03+=1){//I LOVE kkk  BUT WHERE IS MY CHINESE SHU RU FA
		cin>>n>>m>>k;
		for(int i=1;i<=m;++i)cin>>a[i];
		if(k<=n)
			for(int i=1;i<=m;++i){
				cout<<1<<" "<<a[i];
			}
		else {
			while(m--){
				cout<<1<<" "<<1<<endl;
			}
		}
	}
	return 0;
}