#include <bits/stdc++.h>

using namespace std;

#define ll long long
const int INF=1e9;
const ll LINF=1e18,MOD=1e9+7;
#define fi first
#define se second
#define pii pair<int,int>
#define mid ((l+r)/2)
#define sz(a) (int((a).size()))
#define all(a) a.begin(),a.end()
#define endl "\n"
#define pb push_back

void PRINT(int x) {cerr << x;}
void PRINT(ll x) {cerr << x;}
void PRINT(double x) {cerr << x;}
void PRINT(char x) {cerr << '\'' << x << '\'';}
void PRINT(string x) {cerr << '\"' << x << '\"';}
void PRINT(bool x) {cerr << (x ? "true" : "false");}

template<typename T,typename V>
void PRINT(pair<T,V>& x){
    cerr<<"{";
    PRINT(x.fi);
    cerr<<",";
    PRINT(x.se);
    cerr<<"}";
}
template<typename T>
void PRINT(T &x){
    int id=0;
    cerr<<"{";
    for(auto _i:x){
        cerr<<(id++ ? "," : "");
        PRINT(_i);
    }
    cerr<<"}";
}
void _PRINT(){
    cerr<<"]\n";
}
template<typename Head,typename... Tail>
void _PRINT(Head h,Tail... t){
    PRINT(h);
    if(sizeof...(t)) cerr<<", ";
    _PRINT(t...);
}

#define Debug(x...) cerr<<"["<<#x<<"]=["; _PRINT(x)

const int mxN=1e5;

int N,M,S;
vector<int> adj[mxN+1];
vector<int> adj1[mxN+1];
bool visited[mxN+1];
vector<pii> edges;

void Dfs(int u){
    visited[u]=true;
    for(int v:adj[u]){
        if(!visited[v]){
            edges.pb({u,v});
            Dfs(v);
        }
    }
}

void Solve(){
    cin>>N>>M>>S;
    if(S<N){
        set<int> s;
        for(int i=1;i<=S;i++){
            int x; cin>>x;
            s.insert(x);
        }
        for(int i=1;i<=M;i++){
            int u,v; cin>>u>>v;
            if(s.count(u) || s.count(v)){
                adj1[u].pb(v);
                adj1[v].pb(u);
            }
            else{
                adj[u].pb(v);
                adj[v].pb(u);
            }
        }
        for(int u=1;u<=N;u++){
            if(!s.count(u)){
                Dfs(u);
                break;
            }
        }
        bool check=true;
        for(int u=1;u<=N;u++){
            if(!s.count(u)) check&=visited[u];
        }
        if(!check){
            cout<<-1<<endl;
            return;
        }
        for(int u=1;u<=N;u++){
            if(s.count(u)){
                bool found=false;
                for(int v:adj1[u]){
                    if(!s.count(v)){
                        found=true;
                        edges.pb({u,v});
                        break;
                    }
                }
                if(!found){
                    cout<<-1<<endl;
                    return;
                }
            }
        }
        cout<<sz(edges)<<endl;
        for(auto p:edges){
            cout<<p.fi<<" "<<p.se<<endl;
        }
    }
    else{
        if(N==2){
            cout<<1<<endl;
            cout<<1<<" "<<2<<endl;
        }
        else cout<<-1<<endl;
    }
}

void Clear(){
    edges.clear();
    for(int i=1;i<=N;i++){
        visited[i]=false;
        adj[i].clear();
        adj1[i].clear();
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t; cin>>t;
    while(t--){
        Solve();
        Clear();
    }
    return 0;
}