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

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


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

    vector<unordered_set<int>> unionset;

    int t;
    cin >> t;

    while(t--) {
        unionset.clear();
        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});
        }

        for (int i = 0; i < m; i++) {

           // cout << 'a' << endl;
            int l,r;
            l = edges[i].first;
            r = edges[i].second;

            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;
            }

            int ls = -1, rs = -1;
            for (int i = 0; i < unionset.size(); i++) {
                    //printf("m %d\n", unionset[i].size());
                if (unionset[i].count(l)) {
                    ls = i;
                }
                if (unionset[i].count(r)) {
                    rs = i;
                }
            }

            //printf("%d %d %d %d %d\n", i ,l,r,ls,rs);
            if (ls == rs && ls != -1) {
                continue;
            }
            new_edges.push_back(edges[i]);

            if (ls == -1 && rs == -1) {
                unordered_set<int> s;
                s.insert(l);
                s.insert(r);
                unionset.push_back(s);
                continue;
            }
            if (ls == -1) {
                unionset[rs].insert(l);
                continue;
            }
            if (rs == -1) {
                unionset[ls].insert(r);
                continue;
            }

            if (ls < rs) {
                swap(ls, rs);
            }
            unionset[ls].insert(unionset[rs].begin(),unionset[rs].end());
            unionset[rs].clear();
            swap(unionset[rs], unionset.back());
            unionset.pop_back();

            //for (int i = 1; i <= n; i++) {cout << unionset[i] << ' ';} cout << '\n';

        }


       // cout << '\n';
        if (unionset.front().size()!=(n-nisljani.size()) || 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;
            }
            }
        }
    }
}