#include<bits/stdc++.h>
using namespace std;
int t, n, m, s, posbr, sputava[100050], a[100050], b[100050], stepeni[50], br;
vector<int> res;
vector<int> graf[100050];
bool pos[100050];
void OCISTI()
{
    for(int i=1; i<=n; i++)
        graf[i].clear();
}

void DFS(int ind)
{
    pos[ind] = 1;
    posbr++;
    for(int i=0; i<graf[ind].size(); i++)
    {
        if(pos[graf[ind][i]] == 0)
            DFS(graf[ind][i]);
    }
}


bool PROVERA()
{
    memset(pos, 0, sizeof(pos));
    posbr = 0;
    DFS(1);

    if(posbr != n)
        return 0;

    for(int i=1; i<=s; i++)
    {
        if(graf[sputava[i]].size() != 1)
            return 0;
    }
    return 1;
}

int main()
{
    stepeni[0] = 1;
    for(int i=1; i<=26; i++)
        stepeni[i] = stepeni[i-1] * 2;

    cin >> t;
    while(t--)
    {
        cin >> n >> m >> s;
        for(int i=1; i<=s; i++)
            cin >> sputava[i];

        for(int i=1; i<=m; i++)
            cin >> a[i] >> b[i];

        for(int i=1; i<=stepeni[m+1]-1; i++)
        {
            OCISTI();
            br = 0;
            res.clear();
            for(int j=1; j<=m; j++)
            {
                if( (i && stepeni[j]) == 1)
                {
                    res.push_back(j);
                    graf[a[j]].push_back(b[j]);
                    graf[b[j]].push_back(a[j]);
                    br++;
                }
            }
            if(PROVERA())
            {
                cout << br << "\n";
                for(int i=1; i<=br; i++)
                    cout << a[res[i-1]] << " " << b[res[i-1]] << "\n";
                goto ovde;
            }
        }

        cout << "-1\n";
        ovde:
        br = br;
    }
    return 0;
}