#include <iostream>
#include <vector>

using namespace std;

long long n,m,s;

bool dfs(vector<vector<long long>>& sp,vector<bool> vis,vector<bool>& S,long long tr,long long pr,long long jevis,long long res){
if(vis[tr]==false) jevis++;
vis[tr]=true;
if(jevis==n){
    cout << res << "\n";
    return true;
}
if(S[tr]==true){
    if(pr!=0){
        if(S[pr]==true) return false;
        bool a=dfs(sp,vis,S,pr,tr,jevis,res);
        //if(a) cout << tr << " " << pr << "\n";
        return a;
    }
}
for(auto i: sp[tr]){
    bool a=false;
    if(!vis[i]) a=dfs(sp,vis,S,i,tr,jevis,res+1);
    if(a!=false){
        cout << tr << " " << i << "\n";
        return a;
    }
}
if(!S[pr]){
bool a=dfs(sp,vis,S,pr,tr,jevis,res+1);
if(a==true){
    cout << tr << " " << pr << "\n";
    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;
    vector <bool> S(s,false);
    for(long long i=0;i<s;i++){
        long long pom;
        cin >> pom;
        S[pom]=true;
    }
    vector <vector<long long>> sp(m+1);
    for(long long i=0;i<m;i++){
        long long p1,p2;
        cin >> p1 >> p2;
        sp[p1].push_back(p2);
        sp[p2].push_back(p1);
    }
    if(m+1<n){
        cout << "-1 \n";
        continue;
    }
    vector<bool> vis(n+1,false);
    if(!dfs(sp,vis,S,1,0,0,0))cout << "-1 \n";
}
}