#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

int main()
{
    int n, m, s,t, u, v;
    cin>>t;
    while(t--){
        cin>>n>>m>>s;
        vector<int>deca(n+1);
        for(int i=0; i<s; i++){
            int d;
            cin>>d;
            deca[d]=1;
        }
        vector<vector<int>>graf(n+1);
        vector<pair<int,int>>par;
        vector<int>deg(n+1);

        for(int i=0; i<m; i++){
            cin>>u>>v;
            graf[u].push_back(v);
            graf[v].push_back(u);
            deg[u]++; deg[v]++;
            par.push_back({u,v});
        }
        if(m==n-1){
            bool ind=true;
            for(int i=1; i<n+1; i++){
                if(deg[i]>1 && i==1){
                    ind=false; break;
                }
            }
            if(ind){
                cout<<m<<"\n";
                for(auto a:par){
                    cout<<a.first<<" "<<a.second<<"\n";
                }
            }
            else cout<<-1<<"\n";
        }
        else if(s>=n-2){
            if(s==n) cout<<-1<<"\n";
            else{
                priority_queue<pair<int,int>>q;
                for(int i=1; i<n+1; i++){
                    if(deca[i]!=1) q.push({deg[i], i});
                }
                pair<int,int>c1=q.top();
                //cout<<"jfjfb "<<c1.first<<"\n";
                q.pop();
                pair<int,int>c2=q.top();
                if(s==n-1){
                    if(c1.first==n-1){
                        for(auto a: graf[c1.second]){
                            cout<<c1.second<<" "<<a<<"\n";
                        }
                    }
                    else cout<<-1<<"\n";
                }
                else{
                    vector<bool>pos(n+1, false);
                    pos[c1.second]=true;
                    pos[c2.second]=true;
                    int br=2;
                    bool pov=false;
                    vector<pair<int,int>>prr;

                    for(auto a: graf[c1.second]){
                        if(a==c2.second){ prr.push_back({c2.second,c1.second}); pov=true;}
                        else{
                           if(!pos[a]){
                            pos[a]=true;
                            br++;
                            prr.push_back({c1.second,a});
                           }
                        }

                    }
                    for(auto a: graf[c2.second]){
                       if(!pos[a]){
                        pos[a]=true;
                        br++;
                        prr.push_back({c2.second,a});
                       }

                    }
                    if(br==n && pov){
                        cout<<prr.size()<<"\n";
                        for(auto a:prr){
                            cout<<a.first<<" "<<a.second<<"\n";
                        }
                    }
                    else cout<<-1<<"\n";

                }

            }


        }
    }



}