#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const int NN = 202020;
const int MM = 5050;
int deg[NN];
vector<int> _adj[NN];
set<int> adj[NN];
int vst[MM][MM];
int id[NN], rev[NN];
int run, nn;
set<pii> st;
vector<int> vec;
int cliqe(int u) {
  vec.clear();
  for (int v : _adj[u]) {
    if (st.count(pii(deg[v], v))) vec.push_back(v);
  }
  vec.push_back(u);
  for (int i = 0; i < vec.size(); i++) {
    int u = vec[i];
    for (int j = i + 1; j < vec.size(); j++) {
      int v = vec[j];
      if (rev[u] <= nn && rev[v] <= nn) {
        if (vst[rev[u]][rev[v]] != run) return 0;
        if (vst[rev[v]][rev[u]] != run) return 0;
        continue;
      }
      if (adj[u].count(v) == 0) return 0;
      if (adj[v].count(u) == 0) return 0;
    }
  }
  return 1;
}
void erase(int u) {
  st.erase(pii(deg[u], u));
  for (int v : _adj[u]) {
    if (st.count(pii(deg[v], v))) {
      st.erase(pii(deg[v], v));
      deg[v]--;
      if (deg[v] > 0) st.insert(pii(deg[v], v));
    }
  }
}
void solve() {
  int n, m, k;
  run++;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    adj[i].clear();
    _adj[i].clear();
    deg[i] = 0;
    id[i] = i;
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    deg[u]++;
    deg[v]++;
    _adj[u].push_back(v);
    _adj[v].push_back(u);
  }
  sort(id + 1, id + n + 1, [&](int u, int v) { return deg[u] > deg[v]; });
  for (int i = 1; i <= n; i++) rev[id[i]] = i;
  nn = min(n, MM - 1);
  for (int i = 1; i <= n; i++) {
    for (int j : _adj[i]) {
      if (rev[i] <= nn && rev[j] <= nn) {
        vst[rev[i]][rev[j]] = run;
        vst[rev[j]][rev[i]] = run;
        continue;
      }
      adj[i].insert(j);
      adj[j].insert(i);
    }
  }
  st.clear();
  for (int i = 1; i <= n; i++)
    if (deg[i]) st.insert(pii(deg[i], i));
  while (!st.empty()) {
    auto p = *st.begin();
    if (p.first < k - 1) {
      erase(p.second);
    } else if (p.first == k - 1) {
      if (cliqe(p.second)) {
        puts("2");
        for (int u : vec) cout << u << " ";
        puts("");
        return;
      } else {
        erase(p.second);
      }
      assert(vec.size() == k);
    } else {
      cout << "1 " << st.size() << endl;
      for (auto p : st) {
        printf("%d ", p.second);
      }
      puts("");
      return;
    }
  }
  puts("-1");
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
