#include <bits/stdc++.h>

using namespace std;

const int maxn = 2e5;
vector<int> g[maxn];
bool visited[maxn];
bool dobar[maxn];
vector<pair<int, int>> grane;
void dfs(int u){
    visited[u] = true;
    for(auto v: g[u]){
        if(!visited[v] && dobar[v]){
            grane.push_back({u,v});
            dfs(v);
        }
    }
}

int main()
{
    int t;
    cin>>t;
    while(t--){
    for(int i=0;i<maxn;i++){
        g[i].clear();
    }
    grane.clear();
    for(int i=0;i<maxn;i++) visited[i] = false;
    int n,m,s;
    cin>>n>>m>>s;
    int losi[s];
    for(int i=0;i<n;i++) dobar[i] = true;
    for(int i=0;i<s;i++){
        cin>>losi[i];
        losi[i]--;
        dobar[losi[i]] = false;
    }
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        u--;
        v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    for(int i=0;i<n;i++){
        if(dobar[i]){
            dfs(i);
            break;
        }
    }
    for(int i=0;i<s;i++){
        int u = losi[i];
        for(auto v:g[u]){
            if(dobar[v]){
                grane.push_back({u,v});
                break;
            }
        }
    }
    if(grane.size()!=n-1){
        cout<<-1<<endl;
    }
    else{
        cout<<grane.size()<<endl;
        for(auto u:grane){
            cout<<u.first+1<<" "<<u.second+1<<endl;
        }
    }
    }
}