#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+5;


int n, m, k;
vector<int> g[MAXN];
bitset<MAXN> v, b;
vector<array<int,2>> r;

int cnt = 0;
void dfs(int x){
    for(int k : g[x]){
        if(v[k] || b[k]) continue;
        ++cnt;
        v[k] = 1;
        r.push_back({x,k});
        dfs(k);
    }
}

void solve(){
    for(int i = 1; i <= n; ++i){
        g[i].clear();
        v[i] = 0;
        b[i] = 0;
    }
    r.clear();
    cin >> n >> m >> k;
    for(int i = 1; i <= k; ++i){
        int x;
        cin >> x;
        b[x] = 1;
    }
    for(int i = 1; i <= m; ++i){
        int x, y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    int bg = 1;
    while(b[bg])++bg;
    if(bg == n+1){
        cout << "-1\n";
        return;
    }
    v[bg] = 1;
    cnt = 1;
    dfs(bg);
    if(cnt != n-k){
        cout << "-1\n";
        return;
    }
    for(int x = 1; x <= n; ++x){
        if(b[x] == 0) continue;
        bool da = 0;
        for(int k : g[x]){
            if(b[k] == 0){
                r.push_back({x,k});
                da = 1;
                break;
            }
        }
        if(!da){
            cout << "-1\n";
            return;
        }
    }
    cout << r.size() << '\n';
    for(auto p : r){
        cout << p[0] << ' ' << p[1] << '\n';
    }
}

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