#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-6;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int t, n, m, k, tot;
vector<int> g[maxn];
int col[maxn], del[maxn], deg[maxn], ok[maxn];
queue<int> q;
vector<int> ans, num[maxn];
vector<int> cq[maxn];
int main(void) {
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 1; i <= n; i++) {
      g[i].clear();
      del[i] = 0;
      deg[i] = 0;
    }
    int u, v;
    for (int i = 1; i <= m; i++) {
      scanf("%d%d", &u, &v);
      g[u].push_back(v);
      g[v].push_back(u);
      deg[u]++;
      deg[v]++;
    }
    while (!q.empty()) q.pop();
    for (int i = 1; i <= n; i++) {
      if (deg[i] < k) {
        q.push(i);
        del[i] = 1;
      }
    }
    int cnt = 0;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      ++cnt;
      for (auto v : g[u]) {
        if (del[v]) continue;
        deg[v]--;
        if (deg[v] < k) {
          q.push(v);
          del[v] = 1;
        }
      }
    }
    if (cnt < n) {
      ans.clear();
      for (int i = 1; i <= n; i++) {
        if (!del[i]) {
          ans.push_back(i);
        }
      }
      printf("1 %d\n", (int)(ans).size());
      for (int i = 0; i < (int)(ans).size(); i++) {
        printf("%d ", ans[i]);
      }
      puts("");
      continue;
    }
    for (int i = 1; i <= n; i++) {
      del[i] = 0;
      deg[i] = (int)(g[i]).size();
      num[i].clear();
    }
    for (int i = 1; i <= n; i++) {
      if (deg[i] < k - 1) {
        q.push(i);
        del[i] = 1;
      }
    }
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      for (auto v : g[u]) {
        if (del[v]) continue;
        deg[v]--;
        if (deg[v] < k - 1) {
          del[v] = 1;
          q.push(v);
        }
      }
    }
    tot = 0;
    for (int i = 1; i <= n; i++) {
      if (deg[i] == k - 1) {
        q.push(i);
        del[i] = 2;
      }
    }
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      del[u] = 1;
      if (deg[u] == k - 1) {
        ++tot;
        cq[tot].clear();
        cq[tot].push_back(u);
        num[u].push_back(tot);
        for (auto v : g[u]) {
          if (del[v] == 1) continue;
          cq[tot].push_back(v);
          num[v].push_back(tot);
        }
      }
      for (auto v : g[u]) {
        deg[v]--;
        if (del[v]) continue;
        if (deg[v] < k) {
          q.push(v);
          del[v] = 2;
        }
      }
    }
    for (int i = 1; i <= tot; i++) ok[i] = 1;
    for (int i = 1; i <= n; i++) {
      col[i] = 1;
      for (auto v : g[i]) {
        col[v] = 1;
      }
      for (auto v : num[i]) {
        int f = 1;
        for (auto w : cq[v]) {
          if (col[w] == 0) {
            f = 0;
            break;
          }
        }
        if (!f) ok[v] = 0;
      }
      col[i] = 0;
      for (auto v : g[i]) {
        col[v] = 0;
      }
    }
    int f = 0;
    for (int i = 1; i <= tot; i++) {
      if (ok[i]) {
        puts("2");
        for (auto v : cq[i]) {
          printf("%d ", v);
        }
        puts("");
        f = 1;
        break;
      }
    }
    if (f) continue;
    puts("-1");
  }
  return 0;
}
