#include <iostream>
#include <bits/stdc++.h>

using namespace std;

void dfs(int v, vector<vector<int>>& a, vector<pair<int, int>>& r, vector<bool>& vis){
    vis[v] = true;

    for(int i = 0; i < a[v].size(); i++){
        int u = a[v][i];
        if(vis[u]) continue;

        r.push_back(make_pair(v+1, u+1));
        dfs(u, a, r, vis);
    }
}

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

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

        vector<bool> as(n, false);
        vector<vector<int>> a(n);
        vector<pair<int, int>> r;

        for(int i = 0; i < s; i++){
            int b;
            cin >> b;
            b--;
            as[b] = true;
        }

        for(int i = 0; i < m; i++){
            int b, c;
            cin >> b >> c;
            b--; c--;
            if(as[b] && as[c]) continue;
            if((as[b] && a[b].size() > 0) || (as[c] && a[c].size() > 0)) continue;

            a[b].push_back(c);
            a[c].push_back(b);
        }

        vector<bool> vis(n, false);
        for(int i = 0; i < n; i++){
            if(!as[i]){
                dfs(i, a, r, vis);
                break;
            }
        }

        bool k = true;
        for(int i = 0; i < n; i++){
            if(!vis[i]){
                k = false;
                break;
            }
        }

        if(k){
            cout << r.size() << endl;
            for(int i = 0; i < r.size(); i++){
                cout << r[i].first << " " << r[i].second << endl;
            }
        }
        else cout << -1 << endl;
    }

    return 0;
}