#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long int lint;

void solve(){
    int n, m, s;
    cin >> n >> m >> s;
    vector<set<int>> graf(n + 1);
    set<int> nis;
    for(int i = 0; i < s; i++){
        int tr;
        cin >> tr;
        nis.insert(tr);
    }
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        graf[a].insert(b);
        graf[b].insert(a);
    }



    //prvo da se otarasim onih spojenih obojenih

    vector<pair<int, int>> brisisek;

    for(int node = 1; node <= n; node++){
        for(int slnode : graf[node]){
            if(node < slnode){
                if((nis.count(node) == 1) && (nis.count(slnode) == 1)){
                    brisisek.push_back({node, slnode});
                }
            }
        }
    }

    for(int tr = 0; tr < brisisek.size(); tr++){
        int p = brisisek[tr].first;
        int q = brisisek[tr].second;
        graf[p].erase(q);
        graf[q].erase(p);
    }

    vector<pair<int, int>> brisiprim;

    for(int node : nis){
        int siz = graf[node].size();
        int brp = siz - 1;
        vector<pair<int, int>> brisiprim;
        for(int slnode : graf[node]){
            if(brp <= 0){
                break;
            }
            brp--;
            brisiprim.push_back({node, slnode});
        }
        for(int tr = 0; tr < brisiprim.size(); tr++){
            int p = brisiprim[tr].first;
            int q = brisiprim[tr].second;
            graf[p].erase(q);
            graf[q].erase(p);
        }
    }


    vector<bool> mark(n + 1, false);




    int prvi = 1;
    for(int i = 1; i <= n; i++){
        if(graf[i].size() == 1){
            prvi = i;
        }
    }

/*
    cout << endl;
    for(int i = 1; i <= n; i++){
        for(int j : graf[i]){
            if(i < j){
                cout << i << " " << j << endl;
            }
        }
    }
    cout << endl;

    cout << prvi << endl << endl;
*/
    vector<bool> odradjeni(n + 1, false);
    mark[prvi] = true;
    queue<int> red;
    red.push(prvi);

    vector<pair<int, int>> brisi;
    while(!red.empty()){
        int node = red.front();
        red.pop();
        odradjeni[node] = true;

        for(int slnode : graf[node]){
            if(!odradjeni[slnode]){
                if(mark[slnode]){
                    brisi.push_back({node, slnode});
                }
                else{
                    red.push(slnode);
                    mark[slnode] = true;
                }
            }
        }

    }

    for(int tr = 0; tr < brisi.size(); tr++){
        int p = brisi[tr].first;
        int q = brisi[tr].second;
        graf[p].erase(q);
        graf[q].erase(p);
    }

    for(int i = 1; i <= n; i++){
        if(!mark[i]){
            cout << -1 << endl;
            return;
        }
    }

    int suma = 0;
    for(int i = 1; i <= n; i++){
        for(int j : graf[i]){
            if(i < j){
                suma++;
            }
        }
    }

    cout << suma << endl;

    for(int i = 1; i <= n; i++){
        for(int j : graf[i]){
            if(i < j){
                cout << i << " " << j << endl;
            }
        }
    }
}



signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int t = 1;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
/*
5 6 1
5
1 2
1 3
2 3
2 4
3 4
4 5

1
7 9 1
1
1 2
2 3
3 4
2 4
1 5
5 6
6 7
5 7
3 6
*/