#include <bits/stdc++.h>
inline int qr() {
  int f = 0, fu = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') fu = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    f = (f << 3) + (f << 1) + c - 48;
    c = getchar();
  }
  return f * fu;
}
using namespace std;
const int N = 1e5 + 10;
int T, n, m, k, deg[N];
bool v[N];
queue<int> q;
vector<int> G[N], tmp;
int main() {
  T = qr();
  while (T--) {
    n = qr(), m = qr(), k = qr();
    memset(deg, 0, sizeof(int) * (n + 1));
    for (int i = 1; i <= n; ++i) G[i].clear();
    for (int i = 1; i <= m; ++i) {
      int x = qr(), y = qr();
      G[x].push_back(y), G[y].push_back(x);
      deg[x]++, deg[y]++;
    }
    if (1ll * k * (k - 1) / 2 > m) {
      puts("-1");
      continue;
    }
    for (int i = 1; i <= n; ++i) {
      sort(G[i].begin(), G[i].end());
      if (deg[i] < k - 1) q.push(i);
    }
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      if (!deg[x]) continue;
      deg[x] = 0;
      for (int y : G[x])
        if (deg[y] && --deg[y] < k - 1) q.push(y);
    }
    bool suc = false;
    for (int i = 1; i <= n; ++i)
      if (deg[i] == k - 1) q.push(i);
    while (!q.empty()) {
      int x = q.front();
      q.pop(), tmp.clear();
      for (int y : G[x])
        if (deg[y] >= k - 1) tmp.push_back(y);
      if (tmp.size() < k - 1) {
        for (int y : tmp)
          if (--deg[y] == k - 1) q.push(y);
        deg[x] = 0;
        continue;
      }
      bool flag = true;
      for (int i = 0; i <= k - 3; ++i) {
        for (int j = i + 1; j <= k - 2; ++j)
          if (!binary_search(G[tmp[i]].begin(), G[tmp[i]].end(), tmp[j])) {
            flag = false;
            break;
          }
        if (!flag) break;
      }
      if (flag) {
        puts("2");
        printf("%d", x);
        for (int y : tmp) printf(" %d", y);
        puts("");
        suc = true;
        while (!q.empty()) q.pop();
        break;
      } else {
        for (int y : tmp)
          if (--deg[y] == k - 1) q.push(y);
        deg[x] = 0;
      }
    }
    if (suc) continue;
    for (int i = 1; i <= n; ++i)
      if (deg[i] && deg[i] < k) q.push(i);
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      if (!deg[x]) continue;
      deg[x] = 0;
      for (int y : G[x])
        if (deg[y] && --deg[y] < k) q.push(y);
    }
    for (int i = 1; i <= n; ++i)
      if (deg[i] >= k) {
        suc = true;
        tmp.clear();
        q.push(i), v[i] = true;
        while (!q.empty()) {
          int x = q.front();
          tmp.push_back(x);
          q.pop();
          for (int y : G[x]) {
            if (v[y] || deg[y] < k) continue;
            v[y] = true, q.push(y);
          }
        }
        printf("1 %d\n", tmp.size());
        for (int x : tmp) printf("%d ", x), v[x] = false;
        puts("");
        break;
      }
    if (!suc) puts("-1");
  }
  return 0;
}
