#include <bits/stdc++.h>

using namespace std;
vector<int> con1;
vector<int> con2;
vector<int> used = vector<int>(100002);
void dfs(int v, vector<vector<int>> con)
{
    used[v] = 1;
    for(int i = 0; i < con[v].size(); i++)
    {
        if(used[con[v][i]] == 0)
        {
            con1.push_back(v);
            con2.push_back(con[v][i]);
            dfs(con[v][i], con);
        }
    }
}
int main()
{
    int t;
    cin >> t;
    for(int ii = 0; ii < t; ii++)
    {
        used.clear();
        con1.clear();
        con2.clear();
        int n, m, s;
        cin >> n >> m >> s;
        vector<int> hooligans = vector<int>(n, 0);
        for(int i = 0; i < s; i++)
        {
            int x;
            cin >> x;
            x--;
            hooligans[x] = 2;
        }
        vector<vector<int>> con_without_hool =  vector<vector<int>>(n);
        for(int i = 0; i < m; i++)
        {
            int x, y;
            cin >> x >> y;
            x--; y--;
            if(hooligans[x] == 2 && hooligans[y] == 0)
            {
                hooligans[x] = 1;
                s--;
                con1.push_back(x);
                con2.push_back(y);
            }
            if (hooligans[x] == 0 && hooligans[y] == 2)
            {
                hooligans[y] = 1;
                s--;
                con1.push_back(x);
                con2.push_back(y);
            }
            if(hooligans[x] == 0 && hooligans[y] == 0)
            {
                con_without_hool[x].push_back(y);
                con_without_hool[y].push_back(x);
            }
        }
        bool check = true;
        if(s == 0)
        {
            int start = 0;
            while(hooligans[start] == 1) start++;
            dfs(start, con_without_hool);
            for(int i = 0; i < n; i++)
            {
                if(used[i] == 0 && hooligans[i] == 0) check = false;
            }
            if(check)
            {
                cout << n - 1 << "\n";
                for(int j = 0; j < n - 1; j++)
                {
                    cout << con1[j] + 1 << " " << con2[j] + 1<< "\n";
                }
            }
            else cout << -1 << "\n";
        }
        else
        {
            cout << -2<< "\n";
        }

    }
}