#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t; cin >> t;
    while(t--){
        ll n,m,s;
        cin >> n >> m >> s;
        vector<ll> nislija(n+1,0);
        if(m <n-1){
                cout << -1;
                break;}
        for(int i = 0;i < s; i++){
            ll tmp;
            cin >> tmp;
            nislija[tmp]=1;
        }

        vector<vector<ll>>tree(n+1);
        for(int i = 0;i<m;i++){
            ll tmp1,tmp2;
            cin >> tmp1 >> tmp2;
            tree[tmp1].push_back(tmp2);
            tree[tmp2].push_back(tmp1);
        }
        queue<ll> dfs;
        ll mini = LLONG_MAX;
        for(int i = 1;i <=n;i++){
            if(nislija[i]==1) continue;
            mini=i;
            break;
        }

        dfs.push(mini);
        vector<bool> resen(n+1,false);
        ll res = 0;
        ll broj = 0;
        while(!dfs.empty()){
            ll x = dfs.front();
            dfs.pop();
            resen[x]=true;res++;
            if(nislija[x]==1) continue;
            for(auto dete : tree[x]){
                if(resen[dete] == false and nislija[dete]==0){

                    dfs.push(dete);

                    }


            }

        }

        vector<bool> ispisan(n+1,0);
        if(s+res != n){
            cout << -1 << '\n';
        }

        else {

            for(int i = 1;i <= n; i++){
                if(nislija[i]!=1) continue;
                tree[i].erase(tree[i].begin()+1,tree[i].end());
            }
            for(int i = 1;i <= n; i++){
                for(int j=0;j < tree[i].size(); j++){
                    if(nislija[i]==1 and i){
                        broj++;
                        break;
                    }
                    else if((i>tree[i][j] or nislija[tree[i][j]] == 1)) continue;
                    broj++;

                }
            }
            cout << broj << '\n';
            for(int i = 1;i <= n; i++){
                for(int j=0;j < tree[i].size(); j++){
                    if(nislija[i]==1){
                        cout << min(tree[i][j],i) << ' ' << max(tree[i][j],i) << '\n';
                        break;
                    }
                    else if(i>tree[i][j] or nislija[tree[i][j]] == 1) continue;
                    cout << min(tree[i][j],i) << ' ' << max(tree[i][j],i) << '\n';
                }
            }

        }



    }
    return 0;
}