#include <bits/stdc++.h>

using namespace std;

void remove(vector<vector<int>> &graph, int x, int y) {
    vector<int> o;
    for (auto i: graph[x]) {
        if (i != y) o.push_back(i);
    }

    graph[x] = o;
    vector<int> o2;
    for (auto i: graph[y]) {
        if (i != x) o2.push_back(i);
    }

    graph[y] = o2;
}

int dfs(vector<vector<int>> &graph, vector<int> &visited, vector<int> &parent, int i) {
    int res = 0;
    for (auto x: graph[i]) {
        if (!visited[x]) {
            parent[x] = i;
            visited[x] = true;
            res += dfs(graph, visited, parent, x);
        } else if (x != parent[i]) {
            res++;
            remove(graph, i, x);
        }
    }

    return res;
}


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

    int t, n, m, s, a, b;
    cin >> t;
    while (t--) {
        cin >> n >> m >> s;
        vector<int> stop(s);
        vector<vector<int>> graph(n, vector<int>());
        for (int i = 0; i < s; i++) {
            cin >> a;
            stop[i] = a - 1;
        }

        for (int i = 0; i < m; i++) {
            cin >> a >> b;
            a--; b--;
            graph[a].push_back(b);
            graph[b].push_back(a);
        }

        vector<int> visited(n, false);
        vector<int> parent(n, -1);
        visited[0] = true;
        int cyc = dfs(graph, visited, parent, 0);
        if (!cyc) {
            for (auto x: stop) {
                if (graph[x].size() > 1) {
                    cout << "-1" << "\n";
                    return 0;
                }
            }

            cout << m << "\n";
            for (int i = 0; i < m; i++) {
                for (auto y: graph[i]) {
                    if (i > y) continue;
                    cout << i + 1 << " " << y + 1 << "\n";
                }
            }
        }
    }

    return 0;
}