#include<bits/stdc++.h>
using namespace std;
using ll=long long;

const ll N=1e5+555;
ll a[N],ln[N],sz[N],n,m,s;

ll f(ll x){
    return(ln[x]==x?x:ln[x]=f(ln[x]));
}

bool mrg(ll u,ll v){
    u=f(u);
    v=f(v);
    if(u==v)return 0;
    if(sz[u]<sz[v])swap(u,v);
    sz[u]+=sz[v];
    ln[v]=u;
    return 1;
}

void solve(){
    cin>>n>>m>>s;
    for(int i=0;i<=n+5;++i){
        a[i]=0;
        ln[i]=i;
        sz[i]=1;
    }
    vector<array<ll,3>>e;
    for(int i=1;i<=s;++i){
        ll x;cin>>x;
        a[x]=1;
    }
    for(int i=1;i<=m;++i){
        ll u,v;cin>>u>>v;
        e.push_back({a[u]+a[v],u,v});
    }
    sort(e.begin(),e.end());
    vector<array<ll,2>>ans;
    ll c2=0;
    for(auto[_,u,v]:e){
        if(mrg(u,v)){
            c2+=_;
            ans.push_back({u,v});
        }
    }
    ll cnt=0;
    for(int i=1;i<=n;++i){
        cnt+=(f(i)!=f(1));
    }
    if(c2!=s||cnt)cout<<-1<<'\n';
    else{
        cout<<n-1<<'\n';
        for(auto[u,v]:ans)cout<<u<<' '<<v<<'\n';
    }
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll T;cin>>T;
    while(T--)solve();
}