#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 <bool> imasusedakojinijeus(n, false);
        vector <int> tajsusedkojinijeus (n);
        while (m--)
        {
            int a, b;
            cin>>a>>b;
            a--; b--;
            if (blockcvor[a] && !blockcvor[b])
            {
                imasusedakojinijeus[a]=true;
                tajsusedkojinijeus[a]=b+1;
            }
            if (blockcvor[b] && !blockcvor[a])
            {
                imasusedakojinijeus[b]=true;
                tajsusedkojinijeus[b]=a+1;
            }
            g[a].push_back(b);
            g[b].push_back(a);
        }
        for (int i=0; i<n; i++)
        {
            if (blockcvor[i] && !imasusedakojinijeus[i])
            {
                valid=false;
                break;
            }
        }
        if (!valid) cout<<-1<<endl;
        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<<endl;
            else
            {
                cout<<n-1<<endl;
                for (int i=0; i<n; i++)
                {
                    if (blockcvor[i])
                    {
                        cout<<i+1<<" "<<tajsusedkojinijeus[i]<<endl;
                    }
                }
                vis.assign(n, false);
                dfs1(glnode);
            }
        }
    }
    return 0;
}