#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define sc second
#define endl "\n"
#define pii pair<int,int>

using namespace std;

const int MAXN = 1e5+5;
const int mod7 = 1e9+7;
const long long inf = 1e18;

vector<vector<int>> graf(MAXN);
vector<pii> svegrane;
vector<int> parents(MAXN);
vector<int> nmofCMP(MAXN);

int findParent(int x)
{
    if(x!=parents[x])return parents[x] = findParent(parents[x]);
    return parents[x];
}

bool sameCMP(int x, int y)
{
    return findParent(x) == findParent(y);
}

void connectCMP(int x, int y)
{
    int r1 = findParent(x);
    int r2 = findParent(y);
    if(nmofCMP[r1] < nmofCMP[r2])swap(r1,r2);
    parents[r2] = r1;
    nmofCMP[r1] += nmofCMP[r2];
    nmofCMP[r2] = nmofCMP[r1];
}

void reset(int n, int s)
{
    for(int i=0; i<=n; i++)graf[i].clear();
    svegrane.clear();
    for(int i=0; i<=n; i++)nmofCMP[i] = 1;
    for(int i=0; i<=n; i++)parents[i] = i;
}


signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tt;cin >> tt;
    while(tt--)
    {
        int n,m,s;cin >> n >> m >> s;
        reset(n,s);
        vector<bool> bad(n+1, 0);
        vector<bool> flag(n+1, 0);
        set<pii> setic;
        for(int i=0; i<s; i++)
        {
            int x;cin >> x;
            bad[x] = 1;
        }
        for(int i=0; i<m; i++)
        {
            int a,b;cin >> a >> b;
            graf[a].pb(b);
            graf[b].pb(a);
            svegrane.pb({min(a,b),max(a,b)});
        }
        int rez = n;
        vector<pii> rezgrane;
        for(int i = 1; i<=n; i++)
        {
            if(!bad[i] || flag[i])continue;
            if(graf[i].size() == 1)
            {
                int x = graf[i][0];
                connectCMP(i, x);
                //setic.insert(min(i,x), max(i,x));
                rezgrane.pb({i,x});
                rez--;
                flag[i] = 1;
                if(bad[x])flag[x] = 1;
            }
            else
            {
                bool nasao = 0;
                for(auto x: graf[i])
                {
                    if(bad[x] || flag[x])continue;
                    nasao = 1;
                    connectCMP(i, x);
                    //setic.insert(min(i,x), max(i,x));
                    rezgrane.pb({i,x});
                    rez--;
                    flag[i] = 1;
                    if(bad[x])flag[x] = 1;
                    break;
                }
                if(!nasao)
                {
                    rez = -1;
                    break;
                }
            }
        }
        if(rez == -1)
        {
            cout << -1 << endl;
            continue;
        }
        for(auto x: svegrane)
        {
            if(flag[x.fi] || flag[x.sc])continue;
            if(!sameCMP(x.fi, x.sc))
            {
                connectCMP(x.fi,x.sc);
                rezgrane.pb({x.fi, x.sc});
                rez--;
            }
        }
        if(rez == 1)
        {
            cout << n-1 << endl;
            for(auto x: rezgrane)cout << x.fi << " " << x.sc << endl;
        }
        else cout << -1 << endl;



    }


}