#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    vector<vector<int>> G(n + 1);
    vector<int> vis(n + 1);
    vector<int> deg(n + 1);
    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) {
      sort(G[i].begin(), G[i].end());
      deg[i] = G[i].size();
    }
    queue<int> q;
    vector<int> clique;
    for (int i = 1; i <= n; ++i)
      if (deg[i] < k) q.push(i), vis[i] = 1;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      vis[u] = 2;
      if (deg[u] == k - 1 && (long long)k * (k - 1) / 2 <= m &&
          clique.empty()) {
        clique.push_back(u);
        bool flag = 1;
        for (auto v : G[u])
          if (vis[v] <= 1) clique.push_back(v);
        for (auto x : clique)
          for (auto y : clique)
            if (x != y && !binary_search(G[x].begin(), G[x].end(), y))
              flag = false;
        if (!flag) clique.clear();
      }
      for (auto v : G[u]) {
        --deg[v];
        if (vis[v] == 0 && deg[v] < k) {
          vis[v] = 1;
          q.push(v);
        }
      }
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i)
      if (vis[i] == 0) ++ans;
    if (ans > 0) {
      printf("1 %d\n", ans);
      for (int i = 1; i <= n; ++i)
        if (vis[i] == 0) printf("%d ", i);
      printf("\n");
    } else if (!clique.empty()) {
      printf("2\n");
      for (auto u : clique) printf("%d ", u);
      printf("\n");
    } else
      printf("-1\n");
  }
  return 0;
}
