/// 407!3 +/ \!<07!\*
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using db = long double;
using str = string;
using pi = pair<int,int>;
using vi = vector<int>;
using vpi = vector<pi>;
using vvi = vector<vi>;
#define f first
#define s second
#define sz(x) int((x).size())
#define bg(x) begin(x)
#define all(x) bg(x), end(x)
#define rall(x) x.rbegin(), x.rend()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define pb push_back
#define er erase
#define ub upper_bound
#define lb lower_bound
#define FOR(i,a,b) for (ll i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (ll i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const char nl = '\n';

vi par, rnk;

int dsuf(int u){
    if(par[u] == -1)return u;
    return par[u] = dsuf(par[u]);
}

bool dsuu(int u, int v){
    int s1 = dsuf(u), s2 = dsuf(v);
    if(s1 == s2)return 0;
    if(rnk[s1] > rnk[s2]){
        par[s2] = s1;
        rnk[s1] += rnk[s2];
    }
    else{
        par[s1] = s2;
        rnk[s2] += rnk[s1];
    }
    return 1;
}

void solve(){
    int n, m, s;
    cin >> n >> m >> s;
    par.clear();
    rnk.clear();
    par.rsz(n + 1, -1);
    rnk.rsz(n + 1, 1);
    vi v(n + 1);
    F0R(i, s){
        int x;
        cin >> x;
        v[x] = 1;
    }
    vvi g(n + 1);
    F0R(i, m){
        int u, x;
        cin >> u >> x;
        g[u].pb(x);
        g[x].pb(u);
    }
    vpi ans;
    FOR(i, 1, n + 1){
        if(v[i])continue;
        trav(u, g[i]){
            if(v[u])continue;
            bool f = dsuu(i, u);
            if(f)ans.pb({i, u});
        }
    }
    int cnt = 0;
    FOR(i, 1, n + 1){
        if(v[i])continue;
        if(par[i] == -1)cnt++;
    }
    if(cnt > 1){
        cout << -1 << nl;
        return;
    }
    FOR(i, 1, n + 1){
        if(!v[i])continue;
        bool f = 0;
        trav(u, g[i]){
            if(v[u])continue;
            f = 1;
            ans.pb({i, u});
        }
        if(!f){
            cout << -1 << nl;
            return;
        }
    }
    cout << sz(ans) << nl;
    trav(el, ans)cout << el.f << " " << el.s << nl;
}


/*


*/

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