#include <bits/stdc++.h>
using namespace std;
const int maxl = 1e5 + 10;
int n, m, k, ans;
int du[maxl];
vector<int> cliq, subs;
vector<int> e[maxl];
unordered_map<int, bool> mp[maxl];
bool vis[maxl], del[maxl];
inline void prework() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    e[i].clear();
    vis[i] = del[i] = false;
    du[i] = 0;
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    du[u]++;
    du[v]++;
    e[u].push_back(v);
    e[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) sort(e[i].begin(), e[i].end());
}
inline void mainwork() {
  if (1ll * k * (k - 1) > 2 * m) {
    ans = -1;
    return;
  }
  queue<int> q;
  for (int i = 1; i <= n; i++)
    if (du[i] < k) vis[i] = true, q.push(i);
  cliq.clear();
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    if (du[u] == k - 1) {
      cliq.push_back(u);
      for (int v : e[u])
        if (!del[v]) cliq.push_back(v);
      bool flag = true;
      for (int x : cliq)
        for (int y : cliq) {
          if (x == y) break;
          if (!binary_search(e[x].begin(), e[x].end(), y)) flag = false;
        }
      if (flag) {
        ans = 2;
        return;
      }
      cliq.clear();
    }
    del[u] = true;
    for (int v : e[u]) {
      --du[v];
      if (du[v] < k && !vis[v]) {
        vis[v] = true;
        q.push(v);
      }
    }
  }
  subs.clear();
  ans = -1;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) subs.push_back(i), ans = 1;
}
inline void print() {
  if (ans < 0)
    puts("-1");
  else if (ans == 1) {
    int l = subs.size();
    printf("1 %d\n", l);
    for (int i = 0; i < l; i++) printf("%d%c", subs[i], " \n"[i == l - 1]);
  } else {
    puts("2");
    for (int i = 0; i < k; i++) printf("%d%c", cliq[i], " \n"[i == k - 1]);
    return;
  }
}
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) {
    prework();
    mainwork();
    print();
  }
  return 0;
}
