#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ll long long
#define mp make_pair
#define ld long double
const int N=1e5+50;
vector<pair<int,int>>edges;
bool was[N];
struct DSU{
    int par[N];
    int FS(int u){if(par[u]==0)return u;return par[u]=FS(par[u]);}
    bool US(int u,int v){
        u=FS(u),v=FS(v);
        if(u==v)return false;
        par[u]=v;
        return true;
    }
    void Clear(){for(int i=0;i<N;i++)par[i]=0;}
}dsu;
int main(){
    int tt;scanf("%i",&tt);
    while(tt--){
        int n,m,K;scanf("%i%i%i",&n,&m,&K);
        for(int i=1;i<=K;i++){
            int u;scanf("%i",&u);
            was[u]=true;
        }
        for(int i=1;i<=m;i++){
            int u,v;scanf("%i%i",&u,&v);
            edges.pb({u,v});
        }
        vector<pair<int,int>>res;
        int deg[n+5]={0};
        for(auto [u,v]:edges){
            if((!was[u]&&!was[v])||(was[u]&&deg[u]==0&&!was[v])||(was[v]&&deg[v]==0&&!was[u])){
                if(dsu.US(u,v)){
                    res.pb({u,v});
                    deg[u]++,deg[v]++;
                }
            }
        }
        //for(auto [u,v]:res)printf("[%i %i] ",u,v);printf("\n");
        if(res.size()==n-1){
            printf("%i\n",res.size());
            for(auto [u,v]:res)printf("%i %i\n",u,v);
        }
        else printf("-1\n");
        for(int i=0;i<=n;i++){
            was[i]=0;
        }
        edges.clear();
        dsu.Clear();
    }
    return 0;
}