#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 3e5 + 5;
const long long INF = 1e12;
bool isClique(vector<unordered_set<long long>> &adj, long long node) {
  long long k = adj[node].size();
  for (auto it = adj[node].begin(); it != adj[node].end(); it++) {
    long long v = *it;
    for (auto neighbourIt = adj[node].begin(); neighbourIt != adj[node].end();
         neighbourIt++) {
      if (*neighbourIt != v && adj[v].find(*neighbourIt) == adj[v].end()) {
        return false;
      }
    }
  }
  return true;
}
void solve() {
  long long n, m, k;
  cin >> n >> m >> k;
  vector<unordered_set<long long>> adj(n + 1);
  vector<long long> deg(n + 1);
  unordered_set<long long> h;
  vector<bool> visited(n + 1, false);
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].insert(v);
    adj[v].insert(u);
    deg[v]++;
    deg[u]++;
  }
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      pq;
  for (long long i = 1; i < n + 1; i++) {
    pq.push(make_pair(deg[i], i));
    h.insert(i);
  }
  while (pq.size() > 0) {
    long long i = pq.top().second;
    if (h.find(i) == h.end()) {
      pq.pop();
      continue;
    }
    if (pq.top().first >= k) {
      cout << "1 " << h.size() << "\n";
      break;
    }
    if (pq.top().first == k - 1 && isClique(adj, i)) {
      cout << "2 "
           << "\n";
      h = adj[i];
      h.insert(i);
      break;
    }
    h.erase(i);
    pq.pop();
    if (visited[i] == false) {
      visited[i] = true;
      unordered_set<long long> neighbours = adj[i];
      for (auto it = neighbours.begin(); it != neighbours.end(); it++) {
        deg[*it]--;
        adj[i].erase(*it);
        adj[*it].erase(i);
        if (visited[*it] == false) {
          pq.push(make_pair(deg[*it], *it));
          h.insert(*it);
        }
      }
    }
  }
  if (pq.size() == 0) {
    cout << "-1\n";
  } else {
    for (auto it = h.begin(); it != h.end(); it++) {
      cout << *it << " ";
    }
    cout << "\n";
  }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  for (long long i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
