#include <bits/stdc++.h>

using namespace std;
int n,m,s;
vector<int> a;
vector<vector<int>> komsije;
vector<bool> los;
vector<pair<int,int>> parovi;
void bfs(int p, vector<bool>& bio){
    bio[p]=1;
    if(los[p])return;
    for(auto komso : komsije[p]){
        if(!bio[komso]){
            parovi.emplace_back(p,komso);
            bfs(komso,bio);
        }
    }
    return;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t; cin >> t;
    while(t--){
        cin >> n >> m >> s;
        vector<bool> bio(n,0);
        a.resize(s,0);
        los.resize(s,0);
        parovi.clear();
        for(int i=0; i<s; i++){cin >> a[i]; a[i]--; los[a[i]]=1;}
        komsije.resize(n,vector<int>());
        for(int i=0; i<m; i++){
            int u,v; cin >> u >> v;
            u--; v--;
            komsije[u].push_back(v);
            komsije[v].push_back(u);
        }
        int p=0;
        for(; p<n; p++)if(!los[p])break;
        if(los[p]){cout << -1 << '\n'; goto dun;}
        bfs(p, bio);
        for(int i=0; i<n; i++)if(!bio[i]){cout << -1 << '\n'; goto dun;}
        cout << parovi.size() << '\n';
        for(auto par : parovi){
            cout << par.first+1 << ' ' << par.second+1 << '\n';
        }
        dun:;
    }
    return 0;
}