#include <iostream>
#include <bits/stdc++.h>


/*
1
7 9 4
1 2 3 4
1 2
3 4
1 7
2 7
3 7
4 7
7 6
6 5
5 7
*/

using namespace std;
void dfs(vector<set<int>>& grane,set<int> &visited,int start){
   // cout<<"mi v tocke "<<start<<endl;
if(grane[start].size()==0)return ;
 set<int> erased;
for(auto node:grane[start]){
    if(visited.count(node)){
            erased.insert(node);
     //cout<<"Tocku "<<node<<" uze posetili,stiraem granu" <<endl;
    }
    else{
       for(auto ernode:erased){
            //cout<<"Sterli granu "<<start<<' '<<ernode<<endl;
            grane[start].erase(ernode);grane[ernode].erase(start);
       }
       // cout<<"Idem v "<<node<<endl;
        visited.insert(node); grane[node].erase(start);dfs(grane,visited,node);
    }
}
for(auto ernode:erased){
        //cout<<"Sterli granu "<<start<<' '<<ernode<<endl;
        grane[start].erase(ernode);grane[ernode].erase(start);
}
return ;
}
void solve(){
int n,m,s;
cin>>n>>m>>s;

set<int> inS; int x;
set<int> inSnevezan;
for(int i=0;i<s;i++){cin>>x; inS.insert(x);inSnevezan.insert(x);}
set<pair<int,int>> kanali;
for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    if(inS.count(b)){
        int temp=b;b=a;a=temp;
    }
    //prioritet u versin v S
    kanali.insert({a,b});
}

if(s>=n-2){
    bool kanalns=false;
    set<pair<int,int>> kanalicpy=kanali;
    for(auto kanal:kanali){
        if(inS.count(kanal.first))
        {
        if(!inS.count(kanal.second))
            if(inSnevezan.count(kanal.first)){inSnevezan.erase(kanal.first); continue;}
        kanalicpy.erase(kanal);
        }
        else kanalns=true;
    }
    kanali=kanalicpy;
    if(s==n-2){
    if(!inSnevezan.empty() || !kanalns){cout<<-1<<endl;return ;}
    cout<<kanali.size()<<endl;
    for(auto kanal:kanali)cout<<kanal.first<<' '<<kanal.second<<endl;
    return ;
    }
    else{
        if(!inSnevezan.empty()){cout<<-1<<endl;return ;}
        cout<<kanali.size()<<endl;
        for(auto kanal:kanali)cout<<kanal.first<<' '<<kanal.second<<endl;
        return ;
    }
}


//cout<<"Kanali: "<<endl;
//for(auto kanal:kanali){cout<<kanal.first<<' '<<kanal.second<<endl;}
set<pair<int,int>> kanalicpy=kanali;
//cout<<endl;
vector<set<int>> kanalins(n+1);
int kanalnsprimer1=n;
for(auto kanal:kanali){
      //  cout<<"Rassmatrivaem kanal "<<kanal.first<<' '<<kanal.second<<endl;
    if(inS.count(kanal.first)&& inS.count(kanal.second)){kanalicpy.erase(kanal); //cout<<"On iz S v S, delete"<<endl;
    }
    else{
        if(inS.count(kanal.first)){
                //cout<<"On iz S v n-s!"<<endl;
            if(inSnevezan.count(kanal.first)){
                //cout<<"Eto pervaja svaz tocki iz S, ostavljajem!"<<endl;
                inSnevezan.erase(kanal.first);
                continue;
            }
            else {//cout<<"Eto NE pervaja svaz tocki iz S, delete!"<<endl;
                    kanalicpy.erase(kanal);}
        }
       else{
      //  cout<<"On iz N-s v n-s, pisem!"<<endl;
        kanalins[kanal.first].insert(kanal.second);
        kanalins[kanal.second].insert(kanal.first);
        kanalnsprimer1=min(kanalnsprimer1,kanal.first);
        kanalnsprimer1=min(kanalnsprimer1,kanal.second);
        kanalicpy.erase(kanal);
       }
    }

}
kanali=kanalicpy;
//cout<<"Minimalnij v n-s:"<<kanalnsprimer1;
int curnode=kanalnsprimer1;
int minnode=kanalnsprimer1;
set<int> visited;
visited.insert(kanalnsprimer1);
dfs(kanalins,visited,kanalnsprimer1);
//cout<<"Visited:"<<endl;
//for(auto node:visited)cout<<node<<' ';
if(visited.size()!=n-s || !inSnevezan.empty()){cout<<-1<<endl;return ;}
cout<<s+n-s-1<<endl;
for(int i=1;i<=n;i++){
    for(auto node:kanalins[i])cout<<i<<' '<<node<<endl;
}
for(auto kanal:kanali)cout<<kanal.first<<' '<<kanal.second<<endl;
return ;
}

int main()
{

    int t; cin>>t;
    for(int it=0;it<t;it++)solve();
   // cout << "Hello world!" << endl;
    return 0;
}