#include <bits/stdc++.h>
using namespace std;
int N, M, S;
bitset <100001> B, V;
vector <pair <int, int>> OUT;
vector <int> VG[100001];
void DFS(int node)
{
  V[node] = 1;
  for(int x : VG[node])
  {
    if(B[x] || V[x]) continue;
    OUT.push_back({node, x});
    DFS(x);
  }
  return;
}
void Solve()
{
  cin >> N >> M >> S;
  int s;
  for(int i = 1; i <= S; i++)
  {
    cin >> s;
    B[s] = 1;
  }
  int u, v;
  for(int i = 1; i <= M; i++)
  {
    cin >> u >> v;
    VG[u].push_back(v);
    VG[v].push_back(u);
  }
  for(int i = 1; i <= N; i++) if(!B[i]) {DFS(i); break;}
  bool flag = 1;
  for(int i = 1; i <= N; i++) if(!B[i] && !V[i]) {flag = false; break;}
  if((N == 2) && (S == 2))
  {
    for(int x : VG[1]) if(x == 2) {flag = true; break;}
    if(flag) cout << "1\n1 2\n";
    else cout << "-1\n";
  }
  else if(!flag) cout << "-1\n";
  else
  {
    for(int i = 1; i <= N; i++)
    {
      if(!B[i]) continue;
      flag = 0;
      for(int x : VG[i]) if(!B[x]) {OUT.push_back({i, x}); flag = 1; break;}
      if(!flag) {cout << "-1\n"; break;}
    }
    if(flag)
    {
      cout << OUT.size() << '\n';
      for(pair <int, int> p : OUT) cout << p.first << ' ' << p.second << '\n';
    }
  }
  for(int i = 1; i <= N; i++) B[i] = V[i] = 0;
  for(int i = 1; i <= N; i++) VG[i] = vector <int>();
  OUT = vector <pair <int, int>>();
  return;
}
int main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int T;
  cin >> T;
  while(T--) Solve();

  return 0;
}