#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
bool bs(vector<int>& v,int val,int l,int d)
{
	if(d-l<=1)
	{
		if(v[d] == val || v[l] == val)
			return true;
		else
			return false;
	}
	int mid = (l+d)/2;
	if(v[mid] == val)
		return true;
	if(v[mid]>val)
		return bs(v,val,l,mid);
	else
		return bs(v,val,mid+1,d);
}
int main(int argc, char** argv) {
	int t;
	cin>>t;
	while(t--)
	{
		int n,m,s;
		cin>>n>>m>>s;
		vector<int> losi(s);
		for(int i = 0;i<s;i++)
			cin>>losi[i];
		sort(losi.begin(),losi.end());
		vector<vector<int>> adj(n+1),adj1(n+1);
		for(int i = 0;i<m;i++)
		{
			int a,b;
			cin>>a>>b;
			if(!bs(losi,a,0,s-1) && !bs(losi,b,0,s-1))
			{
				adj1[a].push_back(b);
				adj1[b].push_back(a);
			}
			if(!bs(losi,a,0,s-1) || !bs(losi,b,0,s-1))
			{
				adj[a].push_back(b);
				adj[b].push_back(a);
			}
		}
		int src = 1;
		while(bs(losi,src,0,s-1))
			src++;
		if(src == n+1)
			cout<<-1<<endl;
		else
		{
			queue<int> q;
			q.push(src);
			vector<int> posecen(n+1);
			vector<pair<int,int>> uzeti;
			posecen[src] = 1;
			while(q.size()!=0)
			{
				int qs = q.size();
				while(qs--)
				{
					int tren = q.front();
					q.pop();
					for(int j = 0;j<adj1[tren].size();j++)
					{
						if(!posecen[adj1[tren][j]] == 1)
						{
							uzeti.push_back({tren,adj1[tren][j]});
							posecen[adj1[tren][j]] = 1;
							q.push(adj1[tren][j]);
						}
					}
				}
			}
			int br = 0;
			for(int i = 1;i<=n;i++)
			{
				if(posecen[i] == 0)
					br++;
			}
			if(br>s)
				cout<<-1<<endl;
			else
			{
				bool provera = false;
				for(int i = 0;i<losi.size();i++)
				{
					if(adj[losi[i]].size() == 0)
						provera = true;
					else
						uzeti.push_back({losi[i],adj[losi[i]][0]});
				}
				if(provera)
				{
					cout<<-1<<endl;
				}
				else
				{
					cout<<uzeti.size()<<endl;
					for(int i = 0;i<uzeti.size();i++)
						cout<<uzeti[i].first<<" "<<uzeti[i].second<<endl;
				}
			}
		}
	}
}