#include <bits/stdc++.h>

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int T,N,M,S;
    cin>>T;
    for(int i=0;i<T;i++){
        cin>>N>>M>>S;
        int cm=0;
        unordered_set<int> ros;
        for(int j=0;j<S;j++){
            int te;
            cin>>te;
            ros.insert(te);
        }
        //for(const auto& de:ros)cout<<de<<"f\n";
        unordered_map<int,unordered_set<int>> m;
        for(int j=0;j<M;j++){
            int a,b;
            cin>>a>>b;
            if(!(N!=2&&ros.count(a)&&ros.count(b))){
            m[a].insert(b);
            m[b].insert(a);
            cm++;
            }
        }
        //cout<<cm;
        if(cm<N-1){cout<<-1;
        continue;
        }
        //BFS
        unordered_set<int> mar;
        queue<int> q;
        int fir=1;
        while(ros.count(fir))fir++;
        q.push(fir);
        mar.insert(fir);
        vector<pair<int,int>> ans;
        while(!q.empty()){
            int cur=q.front();
            q.pop();
            for(const auto& som:m[cur]){
                if(!mar.count(som)){
                    ans.push_back({cur,som});
                    if(!ros.count(som))q.push(som);
                    mar.insert(som);
                }
            }
        }
        if(ans.size()==N-1){
        cout<<N-1<<"\n";
        for(const auto& pars:ans){
            cout<<pars.first<<" "<<pars.second<<"\n";
        }
        }else cout<<-1<<"\n";
    }
}