#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, M = 2 * N;
int n, m, k;
int h[N], d[N], e[M], ne[M], idx;
bool st[N], vis[N];
vector<int> G[N];
vector<int> tuan;
void add(int a, int b) {
  e[idx] = b, ne[idx] = h[a], h[a] = idx++;
  d[b]++, G[a].push_back(b);
}
void init() {
  idx = 0;
  memset(h, -1, sizeof h);
  for (int i = 0; i <= n + 10; i++) {
    G[i].clear();
    st[i] = d[i] = vis[i] = 0;
  }
}
void dfs(int now) {
  queue<int> q;
  for (int i = 1; i <= n; i++)
    if (d[i] < now) q.push(i), st[i] = true;
  bool ok = false;
  while (q.size()) {
    int t = q.front();
    q.pop();
    if (d[t] == now - 1) {
      tuan.clear();
      tuan.push_back(t);
      for (int i = h[t]; ~i; i = ne[i]) {
        int j = e[i];
        if (vis[j]) continue;
        tuan.push_back(j);
      }
      bool mark = false;
      for (int i = 0; i < tuan.size(); i++)
        for (int j = i + 1; j < tuan.size(); j++) {
          if (!binary_search(G[tuan[i]].begin(), G[tuan[i]].end(), tuan[j]))
            mark = true;
        }
      if (!mark) {
        ok = true;
        break;
      }
    }
    vis[t] = true;
    for (int i = h[t]; ~i; i = ne[i]) {
      int j = e[i];
      d[j]--;
      if (d[j] < now && !st[j]) q.push(j), st[j] = true;
    }
  }
  if (ok) {
    puts("2");
    for (int i = 0; i < tuan.size(); i++) printf("%d ", tuan[i]);
    puts("");
  } else {
    int tmp = 0;
    for (int i = 1; i <= n; i++)
      if (st[i]) tmp++;
    if (tmp < n) {
      printf("1 %d\n", n - tmp);
      for (int i = 1; i <= n; i++)
        if (!st[i]) printf("%d ", i);
      printf("\n");
    } else
      puts("-1");
  }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    init();
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 1; i <= m; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      add(a, b);
      add(b, a);
    }
    if ((long long)k * (k - 1) / 2 > m) {
      printf("-1\n");
      continue;
    }
    for (int i = 1; i <= n; i++) sort(G[i].begin(), G[i].end());
    dfs(k);
  }
  return 0;
}
