#include <bits/stdc++.h>

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t; cin >> t;
    while(t--){
        int n,m,s; cin >> n >> m >> s;
        vector<int> a(s,0);
        vector<bool> los(n,0);
        for(int i=0; i<s; i++){int x; cin >> x; x--; los[x]=1; a[i]=x;}
        vector<vector<int>> komsije(n);
        for(int i=0; i<m; i++){
            int u,v; cin >> u >> v;
            u--; v--;
            if(!los[u] || !los[v]){
            komsije[u].push_back(v);
            komsije[v].push_back(u);
            }
        }
        int p=0;
        vector<bool> posjetio(n,0);
        vector<pair<int,int>> grane;
        queue<int> q;
        for(auto k : a){
            if(komsije[k].empty()){cout << -1 << '\n'; goto dun;}
        }
        while(p<n && los[p])p++;
        q.push(p);
        posjetio[p]=1;
        while(!q.empty()){
            p=q.front(); q.pop();
            for(auto komso : komsije[p]){
                if(!posjetio[komso] && !los[komso]){
                    posjetio[komso]=1;
                    grane.emplace_back(p,komso);
                    q.push(komso);
                }
            }
        }
        for(int k : a){
            grane.emplace_back(k,komsije[k][0]);
            posjetio[k]=1;
        }
        for(int i=0; i<n; i++)if(!posjetio[i]){cout << -1 << '\n'; goto dun;}
        cout << grane.size() << '\n';
        for(auto& par : grane){
            if(par.second < par.first){
                swap(par.second,par.first);
            }
            cout << par.first+1 << ' ' << par.second+1 << '\n';
        }
        dun:;
    }
    return 0;
}