#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define endl "\n"
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);

const int N=1e5+10;
int components=N,maxSize=1;
struct Edge{int u,v;};
vector<Edge>edges;
int dsu[N],sz[N];

vector<pair<int,int>>ans;

void init(int n){
    for(int i=0;i<=n;i++){
        dsu[i]=i;
        sz[i]=1;
    }
}
int find(int x){
    if(dsu[x]==x)return x;
    return dsu[x]=find(dsu[x]);
}

bool unite2(int a,int b,int &components,int &maxSize){
    a=find(a);b=find(b);
    if(a==b)return false;
    if(sz[a]<sz[b])swap(a,b);
    dsu[b]=a;
    sz[a]+=sz[b];
    components--;
    maxSize=max(maxSize, sz[a]);
    return true;
}

void Kruskal(int n,int m){
    int mst=0;
    sort(edges.begin(),edges.end(),
        [](const Edge&a,const Edge&b){return a.u<b.u;});

    for(auto edge:edges){
        if(find(edge.u)!=find(edge.v)){
            mst++;
            unite2(edge.u,edge.v,components,maxSize);
            ans.push_back({edge.u,edge.v});
        }
    }
    ///return mst;
}

void solve(){
    int n,m,s;
    cin>>n>>m>>s;

    init(n);
    edges.clear();
    ans.clear();
    components=n;
    maxSize=1;

    vector<int>sovi(s),marko_nis(n);
    for(int i=0;i<s;i++){
        cin>>sovi[i];
        sovi[i]--;
        marko_nis[sovi[i]]++;
    }


    vector<int>vis(n);
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        u--;v--;

        if(marko_nis[u]==1&&marko_nis[v]==0&&vis[u]==0){
            ///cout<<u<<" "<<v<<endl;
            vis[u]++;
            unite2(u,v,components,maxSize);
            ans.push_back({u,v});
        }
        if(marko_nis[u]==0&&marko_nis[v]==1&&vis[v]==0){
            ///cout<<u<<" "<<v<<endl;
            vis[v]++;
            unite2(u,v,components,maxSize);
            ans.push_back({u,v});

        }
        if(marko_nis[u]==0&&marko_nis[v]==0){
            Edge e1;
            e1.u=u;
            e1.v=v;
            edges.push_back(e1);
        }
    }
    ///cerr<<endl;

    Kruskal(n,m);

    if(ans.size()!=n-1){
        cout<<"-1\n";return;
    }

    cout<<ans.size()<<endl;
    for(auto[u,v]:ans){
        cout<<u+1<<" "<<v+1<<endl;
    }

}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int t=1;
    cin>>t;
    while(t--)solve();
    return 0;
}