#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define MAXN 300010
#define pii pair <ll, ll>

using namespace std;

/**vector <ll> graf[MAXN];
vector <ll> cycle;
vector <ll> deg(MAXN);
vector <bool> pos(MAXN);

bool DFS(ll node, ll par)
{
    cycle.push_back(node);
    pos[node] = true;
    for(auto next : graf[node])
    {
        if(!pos[next]) {if(DFS(next, node)) return true;}
        else if(next != par) {cycle.push_back(next); return true;}
    }
    cycle.pop_back();
    return false;
}

void dfs(ll node)
{
    pos[node] = true;
    for(auto next : graf[node]) {if(!pos[next]) dfs(next);}
}**/

vector <ll> DSU(MAXN);
vector <ll> SIZE(MAXN);
vector <bool> red(MAXN);
vector <ll> cnt(MAXN);

ll root(ll x)
{
    if(x == DSU[x]) return x;
    return DSU[x] = root(DSU[x]);
}

void connect(ll x, ll y)
{
    x = root(x);
    y = root(y);
    if(x == y) return;
    if(red[x]) cnt[x]++;
    if(red[y]) cnt[y]++;
    if(SIZE[x] < SIZE[y]) swap(x, y);
    SIZE[x] += SIZE[y];
    SIZE[y] = 0;
    DSU[y] = x;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll T, N, M, S;
    cin >> T;
    while(T--)
    {
        cin >> N >> M >> S;
        /**set <pii> grane;
        for(int i = 1; i <= N; i++) {graf[i].clear(); pos[i] = false; deg[i] = 0;}**/
        for(int i = 1; i <= N; i++){DSU[i] = i; SIZE[i] = 1; cnt[i] = 0; red[i] = false;}
        vector <pii> grane;
        for(int i = 1; i <= S; i++) {ll x; cin >> x; red[x] = true;}
        for(int i = 1; i <= M; i++)
        {
            ll x, y;
            cin >> x >> y;
            grane.push_back({x, y});
            /**if(!crveni[x] || !crveni[y])
            {
                grane.insert({x, y});
                graf[x].push_back(y);
                graf[y].push_back(x);
                deg[x]++;
                deg[y]++;
            }**/
        }
        vector <pii> res;
        for(auto p : grane)
        {
            ll x = p.first;
            ll y = p.second;
            if(red[x] && red[y]) continue;
            if(red[x]) {if(cnt[x] == 0) {connect(x, y); res.push_back(p);}}
            else if(red[y]) {if(cnt[y] == 0) {connect(x, y); res.push_back(p);}}
            else {connect(x, y); res.push_back(p);}
        }
        bool no = false;
        ll r = root(1);
        for(int i = 1; i <= N; i++) {if(root(i) != r) {cout << -1 << endl; no = true; break;}}
        if(no) continue;
        cout << (ll) res.size() << endl;
        for(auto p : res) cout << p.first << " " << p.second << endl;
        /**ll cnt = 0;
        for(int i = 1; i <= N; i++) {if(!pos[i]) {dfs(i); cnt++;}}
        if(cnt != 1) {cout << -1 << endl; continue;}
        for(int i = 1; i <= N; i++) pos[i] = false;
        for(int i = 1; i <= N; i++)
        {
            if(pos[i]) continue;
            cycle.clear();
            if(DFS(i, -1))
            {
                reverse(cycle.begin(), cycle.end());
                while(cycle.front() != cycle.back()) cycle.pop_back();
                reverse(cycle.begin(), cycle.end());
                ll s = (ll) cycle.size();
                pii sad1 = {cycle[0], cycle[1 % s]};
                pii sad2 = {cycle[1 % s], cycle[0]};
                deg[sad1.first]--;
                deg[sad2.first]--;
                if(grane.find(sad1) != grane.end()) grane.erase(sad1);
                else if(grane.find(sad2) != grane.end()) grane.erase(sad2);
            }
        }
        bool no = false;
        for(int i = 1; i <= N; i++) {if(crveni[i] && deg[i] > 1) {no = true; cout << -1 << endl; break;}}
        if(no) continue;
        cout << (ll) grane.size()<< endl;
        for(auto p : grane) cout << p.first << " " << p.second << endl;**/
    }
    return 0;
}