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

int n, m, s;
bool sput[100010];
vector<vector<int>> l;
bool v[100010];
vector<pair<int, int>> grane;
bool nemoguce;

void dfs(int cvor) {
	v[cvor] = true;
	if(sput[cvor] && cvor != 1)
		return;
	for(auto i : l[cvor]) {
		if(!v[i] && (!sput[cvor] || !sput[i])) {
			grane.emplace_back(cvor, i);
			dfs(i);
			if(sput[cvor])
				break;
		}
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int t;
	cin >> t;
	while(t--) {
		memset(v, false, sizeof(v));
		memset(sput, false, sizeof(sput));
		grane.clear();
		nemoguce = false;
		l.clear();
		cin >> n >> m >> s;
		l.resize(n+1);
		for(int i = 0; i < s; i++) {
			int x;
			cin >> x;
			sput[x] = true;
		}
		for(int i = 0; i < m; i++) {
			int x, y;
			cin >> x >> y;
			l[x].push_back(y);
			l[y].push_back(x);
		}
		dfs(1);
		for(int i = 1; i <= n; i++) {
			if(!v[i]) {
				cout << -1 << '\n';
				nemoguce = true;
				break;
			}
		}
		if(!nemoguce) {
			cout << grane.size() << '\n';
			for(auto i : grane) {
				cout << i.first << ' ' << i.second << '\n';
			}
		}
	}

	return 0;
}