#include <iostream>
#include <vector>

using namespace std;

long long n,m,s;

vector<vector<long long>>sp;
vector<bool> S;

bool dfs(vector<bool> vis,long long tr,long long pr,long long jevis,long long res){
if(vis[tr]==false) jevis++;
//cout << "uslo je " << tr << endl;
vis[tr]=true;
if(jevis==n){
      //  cout << "ima resenje " << endl;
    cout << res << "\n";
    return true;
}
if(S[tr]==true){
   // cout << "marko iz nisa " << endl;
    if(pr!=0){
        if(S[pr]==true) return false;
        bool a=dfs(vis,pr,tr,jevis,res);
       // if(a) cout << tr << " " << pr << "\n";
        return a;
    }
}
//cout << " trazi " << endl;
for(auto i: sp[tr]){
    bool a=false;
    if(!vis[i]) a=dfs(vis,i,tr,jevis,res+1);
    if(a){
        cout << tr << " " << i << "\n";
        return a;
    }

}
//cout << " mozda se vraca " << endl;
if(tr!=1 && !S[pr]){
        //cout << " vraca se " << endl;
bool a=dfs(vis,pr,tr,jevis,res);
if(a==true){
    return a;
}
}
return false;
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while(t!=0){
    t--;
    cin >> n >> m >> s;
    S.erase(S.begin(),S.end());
    S.resize(n+1,false);
    for(long long i=0;i<s;i++){
        long long pom;
        cin >> pom;
        S[pom]=true;
    }
    sp.erase(sp.begin(),sp.end());
    sp.resize(n+1);
    for(long long i=0;i<m;i++){
        long long p1,p2;
        cin >> p1 >> p2;
      //  cout << "dodatko" << endl;
        sp[p1].push_back(p2);
        sp[p2].push_back(p1);
    }
   // cout << "proveri " << endl;
    if(m+1<n){
        cout << "-1 \n";
        continue;
    }
//cout << "krece" << endl;
    vector<bool> vis(n+1,false);
    if(!dfs(vis,1,0,0,0))cout << "-1 \n";
 //   cout << endl;
}
cout << "\n";
return 0;
}