#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define MAXN 300010
#define pii pair <ll, ll>

using namespace std;

vector <ll> graf[MAXN];
vector <ll> cycle;
set <pii> grane;
vector <bool> pos(MAXN);

bool DFS(ll node, ll par)
{
    cycle.push_back(node);
    pos[node] = true;
    for(auto next : graf[node])
    {
        if(!pos[next]) {if(DFS(next, node)) return true;}
        else if(next != par) {cycle.push_back(next); return true;}
    }
    cycle.pop_back();
    return false;
}

void dfs(ll node)
{
    pos[node] = true;
    for(auto next : graf[node]) {if(!pos[next]) dfs(next);}
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll T, N, M, S;
    cin >> T;
    while(T--)
    {
        cin >> N >> M >> S;
        grane.clear();
        for(int i = 1; i <= N; i++) {graf[i].clear(); pos[i] = false;}
        vector <bool> crveni(S + 1);
        bool ne_moze = false;
        for(int i = 1; i <= S; i++) {ll x; cin >> x; crveni[x] = true;}
        for(int i = 1; i <= M; i++)
        {
            ll x, y;
            cin >> x >> y;
            if(!crveni[x] || !crveni[y])
            {
                grane.insert({x, y});
                graf[x].push_back(y);
                graf[y].push_back(x);
            }
        }
        ll cnt = 0;
        for(int i = 1; i <= N; i++) {if(!pos[i]) {dfs(i); cnt++;}}
        if(cnt != 1) {cout << -1 << endl; continue;}
        for(int i = 1; i <= N; i++) pos[i] = false;
        for(int i = 1; i <= N; i++)
        {
            if(pos[i]) continue;
            cycle.clear();
            if(DFS(i, -1))
            {
                reverse(cycle.begin(), cycle.end());
                while(cycle.front() != cycle.back()) cycle.pop_back();
                reverse(cycle.begin(), cycle.end());
                ll s = (ll) cycle.size();
                pii sad1 = {cycle[0], cycle[1 % s]};
                pii sad2 = {cycle[1 % s], cycle[0]};
                if(grane.find(sad1) != grane.end()) grane.erase(sad1);
                else if(grane.find(sad2) != grane.end()) grane.erase(sad2);
            }
        }
        if((ll) grane.size() != N - 1) {cout << -1 << endl; continue;}
        cout << (ll) grane.size()<< endl;
        for(auto p : grane) cout << p.first << " " << p.second << endl;
    }
    return 0;
}