#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++)
    {
        //cout << ind  << ", " << graf[ind][i] << ", " << posbr << "\n";
        if(pos[graf[ind][i]] == 0)
            DFS(graf[ind][i]);
    }
}


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

    //cout << posbr << " " << n << " testiranje \n";
    if(posbr != n)
        return 0;

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

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

    scanf("%d", &t);
    while(t--)
    {
        scanf("%d %d %d", &n, &m, &s);
        for(int i=1; i<=s; i++)
            scanf("%d", &sputava[i]);

        for(int i=1; i<=m; i++)
            scanf("%d %d", &a[i], &b[i]);

        if(m == n-1) /// RADI
        {
            for(int i=1; i<=m; i++)
            {
                graf[a[i]].push_back(b[i]);
                graf[b[i]].push_back(a[i]);

            }
            //cout << "BBB\n";
            bool test = PROVERA();
            if(test)
            {
                cout << m << "\n";
                for(int i=1; i<=m; i++)
                    cout << a[i] << " " << b[i] << "\n";
            }

            else
                cout << "-1\n";
            goto ovde;
        }

        else if(n <= 12 and m <= 22) /// NE RADI
        {
            for(int i=1; i<=stepeni[m+1]-1; i++)
            {
                OCISTI();
                br = 0;
                res.clear();
                for(int j=0; j<=m; j++)
                {
                    //cout << i << " " << stepeni[j] << " " << (i ^ stepeni[j]) << "\n";
                    if( (i ^ stepeni[j]) != 0)
                    {
                        res.push_back(j);
                        graf[a[j]].push_back(b[j]);
                        graf[b[j]].push_back(a[j]);
                        br++;
                    }
                }

                /*cout << "ISPIS GRAFA:\n";
                for(int i=1; i<=n; i++)
                {
                    cout << i << ": ";
                    for(int j=0; j<graf[i].size(); j++)
                        cout << graf[i][j] << " ";
                    cout << "\n";
                }*/

                if(PROVERA())
                {
                    //cout << "MOZE\n";
                    printf("%d\n", br);
                    for(int i=1; i<=br; i++)
                        printf("%d %d\n", a[res[i-1]], b[res[i-1]]);
                    goto ovde;
                }
                //cout << "NEMOZE\n";
            }

            printf("-1\n");
            ovde:
            br = br;
        }

        else
            printf("-1\n");
    }
    return 0;
}