#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;




void dfs(int node, vector<vector<int>>& graf, int& po, vector<bool>& pos, vector<int>& deca, vector<pair<int,int>>& prr) {
    po++;
    pos[node] = true;
    if (deca[node] == 1) return;
    for (auto a : graf[node]) {
        if (!pos[a]) {
            prr.push_back({ node,a });
            dfs(a, graf, po, pos, deca, prr);
        }
    }
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m, s, t, u, v;
    cin >> t;
    while (t--) {
        cin >> n >> m >> s;
        vector<int>deca(n + 1);
        for (int i = 0; i < s; i++) {
            int d;
            cin >> d;
            deca[d] = 1;
        }
        vector<vector<int>>graf(n+1);
        vector<pair<int, int>>par;
        vector<int>deg(n + 1);
        int cvor;
        for (int i = 0; i < m; i++) {
            cin >> u >> v;
            graf[u].push_back(v);
            graf[v].push_back(u);
            deg[u]++; deg[v]++;
            par.push_back({ u,v });
            if (deca[u] != 1) cvor = u;
            else if (deca[v] != 1) cvor = v;
        }
        if (m == n - 1) {
            bool ind = true;
            for (int i = 1; i < n + 1; i++) {
                if (deg[i] > 1 && deca[i]==1) {
                    ind = false; break;
                }
            }
            if (ind) {
                cout << m << "\n";
                for (auto a : par) {
                    cout << a.first << " " << a.second << "\n";
                }
            }
            else cout << -1 << "\n";
        }
        else {
            vector<pair<int, int>>prr;
            vector<bool>pos(n + 1);
            int po = 0;
            dfs(cvor, graf, po, pos, deca, prr);
            if (po == n) {
                cout << prr.size() << "\n";
                for (auto a : prr) {
                    cout << a.first << " " << a.second << "\n";
                }
            }

            else cout << -1 << "\n";

            /*cout << po << endl;
            for (auto a : pos) {
                cout << a << "\n";
            }*/
        }

     }
 }