#include <iostream>
#include <vector>

using namespace std;

void pretraga_u_dubinu(vector<vector<int> > &graf, vector<bool> &posecen, int cvor, vector<pair<int, int> > &grane) {
    posecen[cvor] = true;
    for(int i = 0; i < graf[cvor].size(); i++)
        if(!posecen[graf[cvor][i]]) {
            grane.emplace_back(cvor, graf[cvor][i]);
            pretraga_u_dubinu(graf, posecen, graf[cvor][i], grane);
        }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int t, n, m, s;
    cin >> t;
    while(t--) {
        cin >> n >> m >> s;
        
        vector<vector<int> > veze(n+1);
        vector<bool> posecen(n+1, false);
        vector<int> nislije(s);
        vector<vector<int> > nislijeVeze(n+1);
        vector<pair<int, int> > graneKomponente;
        for(int i = 0; i < s; i++) {
            cin >> nislije[i];
            posecen[nislije[i]] = true;
        }
        
        for(int i = 0; i < m; i++) {
            int u, v;
            cin >> u >> v;
            
            if(!posecen[u] && !posecen[v]) {
                veze[u].push_back(v);
                veze[v].push_back(u);
            }else if(!posecen[u]) {
                nislijeVeze[v].push_back(u);
            }else if(!posecen[v]) {
                nislijeVeze[u].push_back(v);
            }
        }
        
        for(int i = 1; i <= n; i++) {
            if(!posecen[i]) {
                pretraga_u_dubinu(veze, posecen, i, graneKomponente);
                break;
            }
        }
        
        bool moguce = true;
        for(int i = 1; i <= n; i++) {
            if(!posecen[i]) {
                moguce = false;
                break;
            }
        }
        for(int i = 0; i < s; i++) {
            if(nislijeVeze[nislije[i]].empty()) {
                moguce = false;
                break;
            }
        }
        
        if(moguce) {
            cout << graneKomponente.size() + s << '\n';
            for(auto &grana : graneKomponente)
                cout << grana.first << ' ' << grana.second << '\n';
            for(int i = 0; i < s; i++)
                cout << nislije[i] << ' ' << nislijeVeze[nislije[i]][0] << '\n';
        }else{
            cout << "-1\n";
        }
    }
    
    return 0;
}