// takmicenje.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include<vector>
#define int long long
#define pii pair<int,int>
#define MAXN (int)1e5+5
using namespace std;
int vis[MAXN],viss[MAXN];
vector<int>g[MAXN][2];
vector<pii>o;
int z = 0;
void dfs(int x) {
	vis[x] = 1;
	z++;
	for (int& y : g[x][0]) {
		if (!vis[y]) {
			o.emplace_back(x, y);
			dfs(y);
		}
	}
}
void solve() {
	int n,m,s; cin >> n>>m>>s;
	o.clear();
	z = 0;
	for (int i = 1; i <= n; i++) {
		g[i][0].clear();
		g[i][1].clear();
		vis[i] = viss[i] = 0;
	}
	for (int i = 1; i <= s; i++) {
		int x; cin >> x;
		viss[x]=1;
	}
	while (m--) {
		int a, b; cin >> a >> b;
		if (viss[a] || viss[b]) {
			g[a][1].push_back(b);
			g[b][1].push_back(a);
			continue;
		}
		g[a][0].push_back(b);
		g[b][0].push_back(a);
	}for (int i = 1; i <= n; i++) {
		if (viss[i]) { continue; }
		dfs(i);
		break;
	}
	if (z != n - s) {
		cout << -1 << '\n';
	}
	else {
		for (int i = 1; i <= n; i++) {
			if (!viss[i]) {
				for (int& y : g[i][1]){
					if (!vis[y]){
						vis[y] = 1;
						o.emplace_back(i, y);
					}
				}
			}
		}for (int i = 1; i <= n; i++) {
			if (viss[i] && !vis[i]) {
				bool f = 0;
				for (int& y : g[i][1]) {
					if (vis[y]) {
						o.emplace_back(i, y); f = 1; break;
					}
				}
				if (!f) { cout << -1 << '\n'; return; }
			}
		}
		cout << n - 1 << '\n';
		for (auto& x : o) {
			cout << x.first << ' ' << x.second << '\n';
		}
	}
}
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int32_t T = 1; cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}