#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while(t--){
        int n, m, s;
        cin >> n >> m >> s;
        vector<int> nis(s);
        for(int i = 0; i < s; i++){
            cin >> nis[i];
        }
        vector<vector<int>> v(n+1);
        for(int i = 0; i < m; i++){
            int a, b;
            cin >> a >> b;
            v[a].push_back(b);
            v[b].push_back(a);
        }
        bool uspesno = true;
        for(int s : nis){
            if(v[s].size()!=1){
                cout << "-1\n";
                uspesno = false;
                continue;
            }
        }
        if(!uspesno) continue;
        cout << m << "\n";
        for(int i = 1; i <= n; i++){
            for(int j = 0; j < v[i].size(); j++){
                if(i<v[i][j])
                    cout << i << " " << v[i][j] << "\n";
            }
        }
    }
    return 0;
}
/*
1
4 3 1
4
1 2
2 4
3 4
*/