#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
vector <pair<long long, long long>> res;
vector <long long> g[1000001];
bool b[1000001], pos[1000001];
long long kt[1000001];
void dfs (long long cvor, long long pret)
{
    if (pos[cvor]) return;
    pos[cvor] = true;
    res.push_back({cvor,pret});
    for (auto u : g[cvor])
    {
        if (!b[u]) dfs(u,cvor);
    }
    return;
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    long long t, n, m, s, i, h, a, c, poc;
    cin >> t;
    while (t--)
    {
        //obrisati sve (res, g, b, ...)
        for (i = 0; i < 1000001; i++)
        {
            g[i].clear();
            b[i] = false;
            pos[i] = false;
            kt[i] = 0;
            poc = 0;
        }
        //ne mora od 0 do 100001 moze od 0 do n (ispod unosa)
        res.clear();

        cin >> n >> m >> s;
        for (i = 0; i < s; i++)
        {
            cin >> h;
            b[h] = true;
        }
        for (i = 0; i < m; i++)
        {
            cin >> a >> c;
            g[a].push_back(c);
            g[c].push_back(a);
            if (b[a] && !b[c]) kt[a] = c;
            if (!b[a] && b[c]) kt[c] = a;
        }
        bool prv = false;
        for (i = 1; i <= n; i++)
        {
            if (b[i] && kt[i] == 0) prv = true;
            //break ubrzava, ali ne moze zbog ovog dole
            if (b[i]) res.push_back({i,kt[i]});
            if (!b[i]) poc = i;
        }
        if (m < (n-1) || s == n || prv)
        {
            cout << -1 << endl;
            continue; //proveriti jel okej, zameniti redosled u test primeru (prvo -1 pa onaj sa resenjem)
        }
        pos[poc] = true;
        for (auto u : g[poc])
        {
            if (!b[u]) dfs(u,poc);
        }
        bool bul = false;
        for (i = 1; i <= n; i++)
        {
            if (!b[i] && !pos[i]) bul = true;
        }
        if (bul)
        {
            cout << -1;
            continue;
        }
        cout << res.size() << endl;
        for (auto u : res)
        {
            cout << u.first << " " << u.second << endl;
        }
    }
    return 0;
}