#include<bits/stdc++.h>
using namespace std;
int t, n, m, s, brpov, sputani[100050];
vector<int> graf[100050];
bool pos[100050];
int a, b;

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


bool POVEZAN()
{
    memset(pos, 0, sizeof(pos));
    brpov = 0;
    DFS(1);
    //cout << brpov << " ";
    if(brpov == n)
        return 1;
    return 0;
}


bool DA_LI_JE_MST()
{
    int kec = 0;
    int dvojke = 0;
    for(int i=1; i<=n; i++)
    {
        if(graf[i].size() > 2)
            return 0;

        if(graf[i].size() == 2)
            dvojke++;

        if(graf[i].size() == 1)
            kec++;
    }

    if(kec == 2 and dvojke == n - 2)
        return 1;
    return 0;
}

int main()
{
    cin >> t;
    while(t--)
    {
        cin >> n >> m >> s;

        for(int i=1; i<=n; i++)
            graf[i].clear();

        for(int i=1; i<=s; i++)
            cin >> sputani[i];

        for(int i=1; i<=m; i++)
        {
            cin >> a >> b;
            graf[a].push_back(b);
            graf[b].push_back(a);
        }

        /*if(!POVEZAN())
        {
            cout << "-1\n";
            goto ovde;
        }

        if(DA_LI_JE_MST())
            cout << "RADI JOS ZA MST\n"

        /// PRESKOK
        ovde:
        n = n;*/
        cout << "-1\n";
    }
    return 0;
}