#include <bits/stdc++.h>
using namespace std;
vector <vector <int>> g;
vector <bool> vis;
vector <bool> blockcvor;
void dfs (int node)
{
    vis[node]=true;
    for (auto i: g[node])
    {
        if (!vis[i] && !blockcvor[i])
        {
            dfs(i);
        }
    }
}
void dfs1 (int node)
{
    vis[node]=true;
    for (auto i: g[node])
    {
        if (!vis[i] && !blockcvor[i])
        {
            cout<<node+1<<" "<<i+1<<endl;
            dfs1(i);
        }
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t; cin>>t;
    while (t--)
    {
        int n, m, s;
        cin>>n>>m>>s;
        blockcvor.assign(n, false);
        for (int i=0; i<s; i++)
        {
            int x; cin>>x;
            x--;
            blockcvor[x]=true;
        }
        g.resize(n);
        bool valid=true;
        vector <int> tajsusedkojinijeus(n, -1);
        for (int i=0; i<m; i++)
        {
            int a, b;
            cin>>a>>b;
            a--; b--;
            if (blockcvor[a] && !blockcvor[b])
            {
                tajsusedkojinijeus[a]=b;
            }
            if (blockcvor[b] && !blockcvor[a])
            {
                tajsusedkojinijeus[b]=a;
            }
            g[a].push_back(b);
            g[b].push_back(a);
        }
        for (int i=0; i<n; i++)
        {
            if (blockcvor[i] && tajsusedkojinijeus[i]==-1)
            {
                valid=false;
                break;
            }
        }
        if (!valid) cout<<-1<<'\n';
        else
        {
            vis.resize(n, false);
            int glnode=-1;
            for (int i=0; i<n; i++)
            {
                if (!blockcvor[i])
                {
                    glnode=i;
                    break;
                }
            }
            dfs(glnode);
            for (int i=0; i<n; i++)
            {
                if (!blockcvor[i] && !vis[i])
                {
                    valid=false;
                    break;
                }
            }
            if (!valid) cout<<-1<<'\n';
            else
            {
                cout<<n-1<<'\n';
                for (int i=0; i<n; i++)
                {
                    if (blockcvor[i])
                    {
                        cout<<i+1<<" "<<tajsusedkojinijeus[i]+1<<'\n';
                    }
                }
                vis.assign(n, false);
                dfs1(glnode);
            }
        }
    }
    return 0;
}