#include <bits/stdc++.h>

#define int int64_t

signed main()
{
  // prelazim u A kategoriju.
  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;
    std::vector<int> a(s + 1);
    std::set<int> adj[n + 1];
    std::vector<int> vis(n + 1);
    for(int i = 1; i <= s; i++) {
      std::cin >> a[i];
      vis[a[i]] = 1;
    }
    std::map<std::pair<int, int>, int> was;
    std::vector<int> u(m + 1), v(m + 1);
    for(int i = 1; i <= m; i++) {
      std::cin >> u[i] >> v[i];
      adj[u[i]].insert(v[i]);
      adj[v[i]].insert(u[i]);
      was[{u[i], v[i]}] = 1;
      was[{v[i], u[i]}] = 1;
    }
    int ok = 1;
    for(int i = 1; i <= s; i++) {
      std::vector<int> v;
      for(auto u : adj[a[i]]) {
        if(adj[a[i]].size() == 1) {
          break;
        }
        if(adj[u].size() > 1) {
          was[{a[i], u}] = 0;
          was[{u, a[i]}] = 0;
          v.push_back(u);
        }
      }
      for(auto u : v) {
        adj[u].erase(a[i]);
        adj[a[i]].erase(u);
      }
      if(adj[a[i]].size() > 1) {
        ok = 0;
        break;
      }
    }
    std::vector<std::pair<int, int>> ans;
    for(int i = 1; i <= m; i++) {
      if(was[{u[i], v[i]}]) {
        ans.push_back({u[i], v[i]});
      }
    }
    int cmp = 0;
    std::vector<int> visited(n + 1);
    std::function<void(int)> dfs = [&] (int v) {
      if(visited[v]) {
        return;
      }
      visited[v] = 1;
      for(auto u : adj[v]) {
        dfs(u);
      }
    };
    for(int i = 1; i <= n; i++) {
      if(visited[i]) {
        continue;
      }
      cmp += 1;
      dfs(i);
    }
    if(ok == 0 || cmp != 1) {
      std::cout << - 1 << "\n";
    }
    else {
      std::cout << ans.size() << "\n";
      for(auto [q, w] : ans) {
        std::cout << q << " " << w << "\n";
      }
    }
  }
}