#include<bits/stdc++.h>

using namespace std;

void dfs(int u, vector<bool> &los, vector<pair<int, int>> &ans, vector<vector<int>> &e, vector<bool> &b){
    b[u] = true;
    for(int i = 0;i<e[u].size();i++){
        int v = e[u][i];
        if(b[v]) continue;
        ans.push_back({u, v});
        dfs(v, los, ans, e, b);
    }
}

void solve(){
    int n, m, s;
    cin>>n>>m>>s;
    vector<bool> los(n+1, false);
    vector<int> vs;
    for(int i = 0;i<s;i++){
        int u;
        cin>>u;
        vs.push_back(u);
        los[u] = true;
    }
    vector<vector<int>> e(n+1, vector<int>());
    for(int i = 0;i<m;i++){
        int u, v;
        cin>>u>>v;
        e[u].push_back(v);
        e[v].push_back(u);
    }
    vector<pair<int, int>> ans;
    vector<bool> b(n+1, false);
    for(int i = 0;i<s;i++){
        int u = vs[i];
        bool ok = false;
        for(int j = 0;j<e[u].size();j++){
            if(!los[e[u][j]]){
                ok = true;
                ans.push_back({u, e[u][j]});
                b[u] = true;
                break;
            }
        }
        if(!ok){
            cout<<-1<<endl;
            return;
        }
    }
    for(int i = 1;i<=n;i++){
        if(!b[i]){
            dfs(i, los, ans, e, b);
            break;
        }
    }
    for(int i = 1;i<=n;i++){
        if(!b[i]){
            //cout<<"BBB "<<i<<" "<<endl;
            cout<<-1<<endl;
            return;
        }
    }
    cout<<ans.size()<<endl;
    for(int i = 0;i<ans.size();i++){
        cout<<ans[i].first<<" "<<ans[i].second<<endl;
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}