#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;

#define MAXN 100007
vi unionset(MAXN);

int resolve_unionset(int x) {
    if (unionset[x] == x) {
        return x;
    }
    x = resolve_unionset(unionset[x]);
    return x;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;

    while(t--) {
        int n,m,s;
        cin >> n >> m >> s;

        unordered_set<int> nisljani, tuzni_nisljani;
        vector<pair<int,int>> edges, new_edges;

        for (int i = 0; i < s; i++) {
            int tmp;
            cin >> tmp;
            nisljani.insert(tmp);
        }
        for (int i = 0; i < m; i++) {
            int l,r;
            cin >> l >> r;
            edges.push_back({l,r});
        }
        sort(edges.begin(), edges.end());

        for (int i = 1; i <= n; i++) {
            unionset[i] = i;
        }
        for (int i = 0; i < m; i++) {
            int l,r;
            l = edges[i].first;
            r = edges[i].second;
            if (r < l) {
                swap(l,r);
            }

            if (nisljani.count(l) && nisljani.count(r)) {
                continue;
            }
            if (nisljani.count(l)) {
                tuzni_nisljani.insert(l);
                continue;
            }
            if (nisljani.count(r)) {
                tuzni_nisljani.insert(r);
                continue;
            }

            if (resolve_unionset(l) == resolve_unionset(r)) {
                continue;
            }
            unionset[resolve_unionset(r)] = unionset[resolve_unionset(l)];
            new_edges.push_back(edges[i]);
            //for (int i = 1; i <= n; i++) {cout << unionset[i] << ' ';} cout << '\n';
            // printf("%d %d %d\n", i ,l,r);
        }

        int finalset = -1;
        for (int i = 1; i <= n; i++) {
            if (nisljani.count(i) == 0) {
                finalset = resolve_unionset(i);
                break;
            }
        }
        for (int i = 1; i <= n; i++) {
            if (nisljani.count(i)) {
                continue;
            }
            if (resolve_unionset(i) != finalset) {
                finalset = -1;
                //cout << i << '#' << '\n';
                break;
            }
        }
        //cout << '\n';
        if (finalset == -1 || tuzni_nisljani.size() != nisljani.size()) {\
            cout << "-1\n";
        } else {
            cout << (new_edges.size() + nisljani.size()) << '\n';
            for (auto edge : new_edges) {
                cout << edge.first << ' ' << edge.second << '\n';
            }
            for (auto edge : edges) {
                    int l = edge.first;
            int r = edge.second;
                if (nisljani.count(l) && nisljani.count(r)) {
                    continue;
                }
            if (tuzni_nisljani.count(l)) {
                tuzni_nisljani.erase(l);
                cout << l << ' ' << r << '\n';
                continue;
            }
            if (tuzni_nisljani.count(r)) {
                tuzni_nisljani.erase(r);
                cout << l << ' ' << r << '\n';
                continue;
            }
            }
        }
    }
}