#include<bits/stdc++.h>
using namespace std;
typedef long long li;
#define fi first
#define sc second
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
const int maxn = 1e5+5;
int p[maxn], sz[maxn];
bool sp[maxn];
void make(int u){
    p[u] = u;
    sz[u] = 1;
}

int find(int u){
    if(p[u] == u) return u;
    return p[u] = find(p[u]);
}

void join(int a, int b){
    a = find(a);
    b = find(b);
    if(a != b){
        if(sz[a] < sz[b]) swap(a, b);
        p[b] = a;
        sz[a] += sz[b];
    }
}

void solve(){
    int n, m, s; cin >> n >> m >> s;
    memset(sp, 0, sizeof sp);
    for(int i = 0; i < s; i++){
        int a; cin >> a;
        sp[a] = true;
    }

    vector<pii> g;
    vector<pii> los;
    for(int i = 0; i < m; i++){
        int u, v; cin >> u >> v;
        if(sp[u] || sp[v]){
            los.eb(u, v);
        }
        else g.eb(u, v);
    }

    for(int i = 1; i <= n; i++){
        make(i);
    }
    vector<pii> ans;
    for(pii x : g){
        int u = x.fi, v = x.sc;
        if(find(u) != find(v)){
            join(u, v);
            ans.eb(u, v);
        }
    }

    set<int> cm;
    for(int i = 1; i <= n; i++){
        if(sp[i]) continue;
        cm.insert(find(i));
    }

    if(cm.size() > 1) {
        cout << "-1" << '\n';
        return;
    }

    for(pii x : los){
        int u = x.fi, v = x.sc;
        if(sp[u] && sp[v]) continue;
        if(find(u) != find(v)){
            join(u, v);
            ans.eb(u, v);
        }
    }


    cm.clear();
    for(int i = 1; i <= n; i++){
        cm.insert(find(i));
    }

    if(cm.size() > 1) {
        cout << "-1" << '\n';
        return;
    }


    cout << ans.size() << '\n';
    for(pii x : ans){
        cout << x.fi << ' ' << x.sc << '\n';
    }
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int tc;
    cin >> tc;
    while(tc--){
        solve();
    }
    return 0;
}