#include <iostream>
#include <vector>
using namespace std;
int t, n, m, s, x;
struct grana{
    int cvorOd, cvorDo;
}pom;
vector <int> trazeni;
int brUlaznihGrana[100005];
bool smeSeObrisati[200005];
vector <grana> grane;
vector <int> povezani[200005];
void mozeLiSeObrisati(){
    for(int i = 1; i <= n; i++){
        if(--brUlaznihGrana[i] == 0)
            smeSeObrisati[i] = false;
        else
            smeSeObrisati[i] = true;
    }
}
int main(){
    cin >> t;
    while(t--){
        cin >> n >> m >> s;
        trazeni.clear();
        for(int i = 1; i <= n; i++)
            brUlaznihGrana[i] = 0;
        while(s--){
            cin >> x;
            trazeni.push_back(x);
        }
        for(int i = 1; i <= m; i++){
            cin >> pom.cvorOd >> pom.cvorDo;
            brUlaznihGrana[pom.cvorOd]++;
            brUlaznihGrana[pom.cvorDo]++;
            grane.push_back(pom);
            povezani[pom.cvorOd].push_back(pom.cvorDo);
            povezani[pom.cvorDo].push_back(pom.cvorOd);
        }
        if(m == n - 1){
            for(int i = 0; i < trazeni.size(); i++){
                if(brUlaznihGrana[trazeni[i]] > 1){
                    cout << -1 << endl;
                    return 0;
                //cout << i << " " << povezani[i][0] << endl;
                }
            }
            for(int i = 0; i < m; i++)
                cout << grane[i].cvorOd << " " << grane[i].cvorDo << endl;
        }
    }
    //mozeLiSeObrisati();

    return 0;
}