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

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

#define MAXN 100007
vector<int> edges[MAXN];
bool visited[MAXN];
 vector<pair<int,int>> new_edges;

void dfs(int from, int node) {
    if (visited[node]) {
        return;
    }
    visited[node] = true;
    if (from != node) {
        new_edges.push_back({from,node});
    }
    for (auto neighbour: edges[node]) {
        dfs(node, neighbour);
    }
    //cout << "finished node " << node  << '\n';
}

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

    int t;
    cin >> t;

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

        unordered_set<int> nisljani, tuzni_nisljani;
        vector<pair<int,int>> old_edges;

        for (int i = 0; i < s; i++) {
            int tmp;
            cin >> tmp;
            nisljani.insert(tmp);
        }
        for (int i = 1; i <= n; i++) {
            visited[i] = false;
            edges[i].clear();
        }
        for (int i = 0; i < m; i++) {
            int l,r;
            cin >> l >> r;
            if (nisljani.count(l) == 0 && nisljani.count(r) == 0) {
                edges[l].push_back(r);
                edges[r].push_back(l);
            }
            old_edges.push_back({l,r});
        }

        for (int i = 0; i < m; i++) {
            int l,r;
            l = old_edges[i].first;
            r = old_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;
            }
            //for (int i = 1; i <= n; i++) {cout << unionset[i] << ' ';} cout << '\n';
            // printf("%d %d %d\n", i ,l,r);
        }

for (int i = 1; i <= n; i++) {\
    if (nisljani.count(i) == 0) {
        dfs(i,i);
        break;
    }
}
bool possible = true;
for (int i = 1; i <= n; i++) {\
    if (nisljani.count(i) == 0) {
        possible = possible && visited[i];
    }
}
        if (!possible || 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 : old_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;
            }
            }
        }
    }
}