#include<bits/stdc++.h>
using namespace std;
vector <int> a[1000005];
vector<int> prob;
bool povezani[100005];
bool gadan[100005];
bool poseceni[100005];
int s[100005];

int N, M,n,S,k,T;
void MST(int N){
    for(int i=1 ; i<=N;i++){
        if(gadan[i]==false){
            for(int j=0 ; j<=a[i].size()-1;j++)
            if(povezani[a[i][j]]==0){
                povezani[a[i][j]]=true;
                prob.push_back(i);
                prob.push_back(a[i][j]);
            }
        }
    }
}
void DFS(int x){
        poseceni[x]=true;
        //cout<<x<<endl;
        for(int i=0;i<=a[x].size()-1;i++){
            if(poseceni[a[x][i]]==false and gadan[a[x][i]]==false){
            poseceni[a[x][i]]=true;
           // cout<<"posecen u dfs: "<<a[x][i]<<endl;
            DFS(a[x][i]);
            }
        }
}

int main (){
    cin>>T;
    while(T--){
    n=0;
    for(int i=1 ; i<=N;i++){
        gadan[i]=false;
        povezani[i]=false;
        poseceni[i]=false;
        a[i].clear();
    }
    cin>>N>>M>>S;
    for(int i=1 ; i<= S;i++){
        cin>>k;
        gadan[k]=true;
    }
    for(int i=1 ; i<=M;i++){
        int x, y;
        cin>>x>>y;
        a[x].push_back(y);
        a[y].push_back(x);
    }

    povezani[1]=1;
    for(int i=1 ; i<=N;i++){
        if(poseceni[i]==false and gadan[i]==false){
            n++;
            DFS(i);
        }
    }
    MST(N);
    if(n==1){
        cout<<prob.size()/2<<endl;
        for(int i=0 ; i<=prob.size()-1;i+=2){
            cout<<prob[i]<<' '<<prob[i+1]<<endl;
        }
    }else {
            cout<<"-1"<<endl;
        }
    }
    return 0;
}