#include <bits/stdc++.h>

#define int int64_t

const int N = 200001;

struct dsu {
  std::vector<int> G[N];
  int par[N];
  void push(int i) {
    G[i].clear();
    G[i].push_back(i);
    par[i] = i;
  }
  void add(int u, int v) {
    u = par[u];
    v = par[v];
    if(G[u].size() > G[v].size()) {
      std::swap(u, v);
    }
    for(auto x : G[u]) {
      G[v].push_back(x);
      par[x] = v;
    }
    G[u].clear();
  }
  int parent(int v) {
    return par[v];
  }
  int same(int u, int v) {
    return parent(u) == parent(v);
  }
} dsu;

signed main()
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int tt;
  std::cin >> tt;
  while(tt--) {
    int n, m, s;
    std::cin >> n >> m >> s;
    for(int i = 1; i <= n; i++) {
      dsu.push(i);
    }
    std::vector<int> a(n + 1);
    for(int i = 1; i <= s; i++) {
      int x;
      std::cin >> x;
      a[x] = 1;
    }
    std::vector<std::pair<int, int>> ans;
    std::vector<int> adj(n + 1);
    for(int i = 1; i <= m; i++) {
      int u, v;
      std::cin >> u >> v;
      if(a[u] && adj[u] > 0) {
        continue;
      }
      if(a[v] && adj[v] > 0) {
        continue;
      }
      if(!dsu.same(u, v)) {
        ans.push_back({u, v});
        dsu.add(u, v);
        adj[u] += 1;
        adj[v] += 1;
      }
    }
    int ok = 1;
    for(int i = 1; i <= n; i++) {
      ok &= dsu.same(i, 1);
    }
    if(ok == 0) {
      std::cout << - 1 << "\n";
    }
    else {
      std::cout << ans.size() << "\n";
      for(auto [u, v] : ans) {
        std::cout << u << " " << v << "\n";
      }
    }
  }
}