#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<int> adj[100005];
int din[100005];
queue<int> que;
int Vec[100005], V_size;
int a, b, c, d, cur;
bool succ;
int main() {
  int Test;
  scanf("%d", &Test);
  while (Test--) {
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 1; i <= n; i += 1) {
      adj[i].clear();
      din[i] = 0;
    }
    while (!que.empty()) que.pop();
    for (int i = 1; i <= m; i += 1) {
      scanf("%d%d", &a, &b);
      adj[a].push_back(b), adj[b].push_back(a);
      din[a]++, din[b]++;
    }
    if (k == 1) {
      puts("2");
      puts("1");
      continue;
    }
    for (int i = 1; i <= n; i += 1) sort(adj[i].begin(), adj[i].end());
    for (int i = 1; i <= n; i += 1)
      if (din[i] < (k - 1)) que.push(i);
    while (!que.empty()) {
      cur = que.front();
      que.pop();
      for (auto& i : adj[cur]) {
        din[cur]--, din[i]--;
        if (din[i] == (k - 2)) que.push(i);
      }
    }
    for (int i = 1; i <= n; i += 1)
      if (din[i] == (k - 1)) que.push(i);
    bool nex_loop = false;
    while (!que.empty()) {
      cur = que.front();
      que.pop();
      if (din[cur] == (k - 1)) {
        V_size = 0;
        for (auto& i : adj[cur]) {
          if (din[i] <= 0) continue;
          Vec[V_size++] = i;
        }
        succ = true;
        for (int i = 0; i <= V_size - 1; i += 1) {
          for (int j = i + 1; j <= V_size - 1; j += 1) {
            a = Vec[i], b = Vec[j];
            auto it = lower_bound(adj[a].begin(), adj[a].end(), b);
            if ((it == adj[a].end()) || (*it != b)) {
              succ = false;
              break;
            }
          }
          if (!succ) break;
        }
        if (succ) {
          puts("2");
          printf("%d ", cur);
          for (int i = 0; i <= V_size - 1; i += 1) printf("%d ", Vec[i]);
          printf("\n");
          nex_loop = true;
          break;
        }
      }
      for (auto& i : adj[cur]) {
        if (din[i] <= 0) continue;
        din[cur]--, din[i]--;
        if (din[i] == (k - 1)) que.push(i);
      }
    }
    if (nex_loop) continue;
    V_size = 0;
    for (int i = 1; i <= n; i += 1) {
      if (din[i] <= 0) continue;
      Vec[V_size++] = i;
    }
    if (V_size == 0)
      puts("-1");
    else {
      printf("1 %d\n", V_size);
      for (int i = 0; i <= V_size - 1; i += 1) {
        printf("%d ", Vec[i]);
      }
      printf("\n");
    }
  }
  return 0;
}
