#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 9;
const int MAX = 2e2 + 9;
const double ep = 1e-6;
const int mod = 998244353;
const int INF = 0x3f3f3f3f;
const double inf = 1e20;
const double pi = acos(-1);
vector<int> vec[maxn];
int n, m, k, d[maxn], cnt1, ans[maxn], tot;
bool vis[maxn];
bool solve1() {
  queue<int> q;
  cnt1 = 0;
  for (int i = (1); i <= (n); ++i) {
    if (d[i] < k) q.push(i), vis[i] = 1;
  }
  while (!q.empty()) {
    int p = q.front();
    q.pop();
    cnt1++;
    if (d[p] == k - 1) {
      ans[tot = 1] = p;
      bool ju = 0;
      for (int i : vec[p]) {
        if (d[i] < k - 1) continue;
        for (int j : vec[p]) {
          if (i == j) break;
          if (d[j] < k - 1) continue;
          auto k = lower_bound(vec[j].begin(), vec[j].end(), i);
          if (k == vec[j].end() || (*k) != i) {
            ju = 1;
            break;
          }
        }
        if (ju) break;
        ans[++tot] = i;
      }
      if (!ju && tot == k) {
        puts("2");
        for (int i = (1); i <= (k); ++i) printf("%d ", (ans[i]));
        puts("");
        return 1;
      }
    }
    d[p] = 0;
    for (int to : vec[p]) {
      d[to]--;
      if (vis[to]) continue;
      if (d[to] < k) {
        vis[to] = 1;
        q.push(to);
      }
    }
  }
  if (n - cnt1 < k) return 0;
  printf("%d %d\n", (1), (n - cnt1));
  for (int i = (1); i <= (n); ++i)
    if (!vis[i]) printf("%d ", (i));
  puts("");
  return 1;
}
void solve() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = (1); i <= (n); ++i) d[i] = 0, vis[i] = 0, vec[i].clear();
  for (int i = (1); i <= (m); ++i) {
    int u, v;
    scanf("%d%d", &(u), &(v));
    vec[u].emplace_back(v);
    vec[v].emplace_back(u);
    d[u]++;
    d[v]++;
  }
  if (1ll * k * (k - 1) / 2 > m) {
    puts("-1");
    return;
  }
  for (int i = (1); i <= (n); ++i) sort(vec[i].begin(), vec[i].end());
  if (solve1()) return;
  puts("-1");
}
int main() {
  int T = 1;
  scanf("%d", &(T));
  while (T--) solve();
}
