#include <bits/stdc++.h>
#define ll long long
using namespace std;
int T, N, M, S, a, b, s[100005], VezaA[2000005], VezaB[200005], Parent[100005], BrojVeza[100005];
vector <int> KoristimVezu;
int ParentCvora(int i){
    while(Parent[i] != i)i = Parent[i];

    return i;
}

int DuzinaPodstabla(int i){
    int Duzina = 0;
    while(Parent[i] != i){
        Duzina++;
        i = Parent[i];
    }
    return Duzina;
}

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> T;
    while(T--){
        cin >> N >> M >> S;
        for(int i = 1; i <= N; i++) Parent[i] = i;
        for(int i = 1; i <= S; i++) cin >> s[i];
        for(int i = 1; i <= M; i++){
            cin >> VezaA[i] >> VezaB[i];
            a = VezaA[i], b = VezaB[i];
            if(ParentCvora(a) == ParentCvora(b)) continue;

            if(DuzinaPodstabla(a) <= DuzinaPodstabla(b))Parent[a] = b;
            else Parent[a] = b;

            BrojVeza[a]++;
            BrojVeza[b]++;
            KoristimVezu.push_back(i);
        }

        bool SolBool = true;
        for(int i = 1; i <= S; i++){
            if(BrojVeza[s[i]] != 1) SolBool = false;
        }
        if(!SolBool) cout << "-1" << endl;
        else{
            cout << KoristimVezu.size() << endl;
            for(int i = 0; i < KoristimVezu.size(); i++){
                cout << VezaA[KoristimVezu[i]] << " " << VezaB[KoristimVezu[i]] << endl;
            }
        }
    }
return 0;
}