#include <bits/stdc++.h>
using namespace std;
vector<int> E[100000 + 5];
int in[100000 + 5];
void add_edge(int u, int v) {
  in[u]++;
  in[v]++;
  E[u].push_back(v);
  E[v].push_back(u);
}
int cas;
int n, m, K;
vector<int> subs, cli;
bool vis[100000 + 5];
bool isCli(int x) {
  cli.clear();
  cli.push_back(x);
  for (int y : E[x])
    if (!vis[y]) cli.push_back(y);
  for (int i : cli) {
    for (int j : cli) {
      if (i == j) continue;
      if (!binary_search(E[i].begin(), E[i].end(), j)) return 0;
    }
  }
  return 1;
}
void topo_sort() {
  queue<int> q;
  for (int i = 1; i <= n; i++)
    if (in[i] < K) q.push(i);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    vis[x] = 1;
    if (in[x] == K - 1) {
      if (isCli(x)) {
        printf("2\n");
        for (int t : cli) printf("%d ", t);
        printf("\n");
        return;
      }
    }
    for (int y : E[x]) {
      if (!vis[y]) {
        in[y]--;
        if (in[y] == K - 1) q.push(y);
      }
    }
  }
  subs.clear();
  for (int i = 1; i <= n; i++)
    if (!vis[i]) subs.push_back(i);
  if (!subs.empty()) {
    printf("1 %d\n", subs.size());
    for (int t : subs) printf("%d ", t);
    printf("\n");
  } else
    printf("-1\n");
}
void ini() {
  for (int i = 1; i <= n; i++) {
    E[i].clear();
    in[i] = 0;
    vis[i] = 0;
  }
}
int main() {
  int u, v;
  scanf("%d", &cas);
  while (cas--) {
    scanf("%d %d %d", &n, &m, &K);
    ini();
    for (int i = 1; i <= m; i++) {
      scanf("%d %d", &u, &v);
      add_edge(u, v);
    }
    if (K * (K - 1) / 2 > m) {
      printf("-1\n");
      continue;
    }
    for (int i = 1; i <= n; i++) sort(E[i].begin(), E[i].end());
    topo_sort();
  }
}
