#include <bits/stdc++.h>
using namespace std;
int br;
bool posecen[100005];
void dfs(vector<vector<int>> &v,int i,vector<pair<int,int>> &res)
{
    br++;
    posecen[i] = true;
    for ( int j = 0 ; j < v[i].size(); j++)
    {
        if ( !posecen[v[i][j]])
        {
            dfs(v,v[i][j],res);
            res.push_back(make_pair(i,v[i][j]));
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m,t,s,x;
    cin >> t;
    while(t--)
    {
        cin >> n >> m >> s;
        set<int> bad,good;
        for ( int i = 0 ; i < s ; i++)
        {
            cin >> x;
            bad.insert(x);
        }
        for ( int i = 1 ; i <= n ; i++)
            if ( bad.count(i) == 0) good.insert(i);
        vector<vector<int>> v(n+1);
        for ( int i = 0 ; i < m ; i++)
        {
            int a,b;
            cin >> a >> b;
            if ( good.count(a) == 1) v[b].push_back(a);
            if ( good.count(b) == 1) v[a].push_back(b);
        }
        br = 0;
        for ( int i = 1 ;  i<= n ; i++) posecen[i] = false;
        vector<pair<int,int>> res;
        dfs(v,*good.begin(),res);
        bool moze = true;
        if ( br == n - s)
        {
            for ( auto it = bad.begin() ; it != bad.end() ; it++)
            {
                int p = *it;
                if ( v[p].size() == 0)
                {
                    moze = false;
                    break;
                }
                else res.push_back(make_pair(p,v[p][0]));
            }
            if ( moze )
            {
                cout << res.size() << endl;
                for ( int i = 0 ; i < n -1 ; i++) cout << res[i].first << " " << res[i].second << endl;
            }
            else cout << -1 << endl;
        }
        else cout << -1 << endl;
    }
}