#include <iostream>
#include <vector>

using namespace std;

int n,m,s;

vector<vector<int>>sp;
vector<bool> S;
vector<bool> vis;


bool dfs(int tr,int pr,int jevis,int res){
bool PR=vis[tr];
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){
            vis[tr]=PR;
            return false;
        }
        bool a=dfs(pr,tr,jevis,res);
       // if(a) cout << tr << " " << pr << "\n";
        if(!a)vis[tr]=PR;
        return a;
    }
}
//cout << " trazi " << endl;
for(auto i: sp[tr]){
    bool a=false;
    bool Pr=vis[i];
    if(!vis[i]) a=dfs(i,tr,jevis,res+1);
    if(a){
        cout << tr << " " << i << "\n";
        return a;
    }
    else vis[i]=Pr;

}
//cout << " mozda se vraca " << endl;
if(tr!=1 && !S[pr]){
        //cout << " vraca se " << endl;
bool a=dfs(pr,tr,jevis,res);
if(a==true){
    return a;
}
}
vis[tr]=PR;
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(int i=0;i<s;i++){
        int pom;
        cin >> pom;
        S[pom]=true;
    }
    sp.erase(sp.begin(),sp.end());
    sp.resize(n+1);
    for(int i=0;i<m;i++){
        int 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;
    vis.erase(vis.begin(),vis.end());
    vis.resize(n+1,false);
    if(!dfs(1,0,0,0))cout << "-1 \n";
 //   cout << endl;
}
cout << "\n";
return 0;
}