#include <iostream>
#include <map>
#include <vector>
#include <queue>
using namespace std;

int main()
{
    int t,res=0;
    scanf("%d", &t);
    while (t--) {
        int n, m, s, x, y;
        scanf("%d %d %d", &n, &m, &s);
        vector<int> ls;
        map<int, int> isS;
        map<int, int> deg;
        for (int i=0; i<s; i++) {
            scanf("%d", &x);
            ls.push_back(x);
            isS[x] = 1;
        }
        vector<int> g[n+1];
        map<pair<int, int>, int> deleted;
        for (int i=0; i<m; i++) {
            scanf("%d %d", &x, &y);
            g[x].push_back(y);
            g[y].push_back(x);
            deg[x]++;
            deg[y]++;
            deleted[{x, y}] = 0;
            deleted[{y, x}] = 0;
        }
        for (auto el : ls) {
            int toRemove=deg[el]-1;
            for (auto adj : g[el]) {
                if (toRemove > 0 && isS[adj] && deleted[{el, adj}] == 0) {
                    // sklanjaj el - adj
                    deleted[{el, adj}] = 1;
                    deg[el]--;
                    deg[adj]--;
                    toRemove--;
                    if (toRemove==0) break;
                }
            }
            for (auto adj : g[el]) {
                if (toRemove==0) break;
                if (toRemove > 0 &&  deleted[{el, adj}] == 0) {
                    // sklanjaj el - adj
                    deleted[{el, adj}] = 1;
                    deg[el]--;
                    deg[adj]--;
                    toRemove--;
                    if (toRemove==0) break;
                }
            }
            if (toRemove>0) {
                res = -1;
                break;
            }
        }

        if (res == -1) {
            printf("-1\n");
            continue;
        }
        vector<int> visited(n+1, 0);
        queue<int> q;
        q.push(x);
        while (!q.empty()) {
            int top = q.front();
            q.pop();
            visited[top] = 1;
            for (auto adj : g[top]) {
                if (visited[adj] == 0 && deleted[{top, adj}] == 0) {
                    q.push(adj);
                }
            }
        }
        int cc=0;
        for (auto el : visited) {
            cc+=el;
        }
        if (cc == n) {
            for (int i=1; i<=n; i++) {
                for (auto adj : g[i]) {
                    if (deleted[{i, adj}] == 0) {
                        printf("%d %d\n", i, adj);
                    }
                }
            }
        } else printf("-1\n");
    }
    return 0;
}