#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
vector<int> g[maxn];
int deg[maxn], vis[maxn];
queue<int> q;
vector<int> c;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, m, k;
    c.clear();
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 1; i <= n; ++i) g[i].clear();
    for (int i = 0; i < m; ++i) {
      int u, v;
      scanf("%d%d", &u, &v);
      g[u].push_back(v);
      g[v].push_back(u);
    }
    for (int i = 1; i <= n; ++i) {
      vis[i] = 0;
      deg[i] = g[i].size();
      sort(g[i].begin(), g[i].end());
      if (deg[i] < k) q.push(i);
    }
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      if (deg[u] == k - 1 && c.empty()) {
        bool ok = true;
        c.push_back(u);
        for (auto v : g[u]) {
          if (vis[v]) continue;
          if (deg[v] < k - 1) {
            ok = false;
            break;
          }
          c.push_back(v);
        }
        if (ok) {
          for (int i = 0; i < c.size(); ++i) {
            for (int j = 0; j < c.size(); ++j) {
              if (i == j) continue;
              int u = c[i], v = c[j];
              if (!binary_search(g[u].begin(), g[u].end(), v)) {
                ok = false;
                goto L;
              }
            }
          }
        L:;
        }
        if (!ok) c.clear();
      }
      vis[u] = 1;
      for (auto v : g[u]) {
        deg[v]--;
        deg[u]--;
        if (deg[v] == k - 1) q.push(v);
      }
    }
    vector<int> ans;
    for (int i = 1; i <= n; ++i)
      if (deg[i] >= k) ans.push_back(i);
    if (!ans.empty()) {
      printf("1 %d\n", (int)ans.size());
      for (auto u : ans) printf("%d ", u);
      puts("");
    } else if (!c.empty()) {
      printf("2\n");
      for (auto u : c) printf("%d ", u);
      puts("");
    } else
      printf("-1\n");
  }
}
