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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);
    int t;
    cin >> t;
    while (t--) {
        int n, m, s;
        cin >> n >> m >> s;
        vector<int> gazda(n);
        for (int i = 0; i < n; i++)
            gazda[i] = i;
        vector<int> nislije(n);
        int x;
        while (s--) {
            cin >> x;
            nislije[x - 1] = 1;
        }
        vector<pair<int, int>> ocemo;
        for (int i = 0; i < m; i++) {
            int a, b;
            cin >> a >> b;
            a--;
            b--;
            if (nislije[a] == 1 && nislije[b] == 0) {
                nislije[a]++;
                gazda[a] = b;
                ocemo.push_back(make_pair(a, b));
            }
            else if (nislije[a] == 0 && nislije[b] == 1) {
                nislije[b]++;
                gazda[b] = a;
                ocemo.push_back(make_pair(a, b));
            }
            else if (nislije[a] == 0 && nislije[b] == 0) {
                int jacina_a = 1;
                while (gazda[a] != gazda[gazda[a]]) {
                    gazda[a] = gazda[gazda[a]];
                    jacina_a++;
                }
                int jacina_b = 1;
                while (gazda[b] != gazda[gazda[b]]) {
                    gazda[b] = gazda[gazda[b]];
                    jacina_b++;
                }
                if (gazda[a] != gazda[b]) {
                    if (jacina_a < jacina_b)
                        gazda[a] = gazda[b];
                    else
                        gazda[b] = gazda[a];
                    ocemo.push_back(make_pair(a, b));
                }
            }
        }
        while (gazda[0] != gazda[gazda[0]]) {
            gazda[0] = gazda[gazda[0]];
        }
        int vrhovni = gazda[0];
        bool moze = true;
        for (int i = 0; i < n && moze; i++) {
            while (gazda[i] != gazda[gazda[i]]) {
                gazda[i] = gazda[gazda[i]];
            }
            if (gazda[i] != vrhovni) {
                moze = false;
                break;
            }
        }
        if (moze) {
            cout << ocemo.size() << '\n';
            for (auto it : ocemo)
                cout << it.first + 1 << ' ' << it.second + 1 << '\n';
        }
        else
            cout << -1 << '\n';
    }
    return 0;
}