#include <bits/stdc++.h>

using namespace std;

#define MAXN 100005
#define int long long

int n,m,s;
set<int> specialnode;
vector<int> adj[MAXN];
int parent[MAXN],siz[MAXN];
vector<pair<int,int>> answer;

int get(int node)
{
    if (parent[node]==node) return node;
    return get(parent[node]);
}

bool unite(int node1,int node2)
{
    node1=get(node1),node2=get(node2);
    if (node1==node2) return false;
    if (siz[node1]<siz[node2]) swap(node1,node2);
    parent[node2]=node1;siz[node1]+=siz[node2];
    return true;
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t;cin>>t;
    for (int z=0;z<t;z++)
    {
        cin>>n>>m>>s;
        for (int i=1;i<=s;i++) {int node;cin>>node;specialnode.insert(node);}
        for (int i=1;i<=m;i++) {int u,v;cin>>u>>v;adj[u].push_back(v);adj[v].push_back(u);}
        for (int node=1;node<=n;node++) {parent[node]=node;siz[node]=1;}
        for (int node=1;node<=n;node++)
        {
            if (specialnode.find(node)!=specialnode.end()) continue;
            for (int sled:adj[node])
            {
                if (specialnode.find(sled)!=specialnode.end()) continue;
                if (unite(node,sled)) answer.push_back({node,sled});
            }
        }
        for (int node:specialnode)
        {
            for (int sled:adj[node])
            {
                if (specialnode.find(sled)!=specialnode.end()) continue;
                if (unite(node,sled)) {answer.push_back({node,sled});break;}
            }
        }
        if ((int)answer.size()!=n-1) cout<<-1<<endl;
        else
        {
            cout<<n-1<<endl;
            for (pair<int,int> edge:answer) cout<<edge.first<<" "<<edge.second<<endl;
        }
        specialnode.clear();answer.clear();
        for (int node=1;node<=n;node++) adj[node].clear();
    }
}