#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  cout.tie(0);
  int T = 1;
  cin >> T;
  while (T--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<int>> e(n);
    for (int i = 0; i < m; i++) {
      int u, v;
      cin >> u >> v;
      --u, --v;
      e[u].push_back(v);
      e[v].push_back(u);
    }
    vector<int> deg(n);
    for (int i = 0; i < n; i++)
      sort(e[i].begin(), e[i].end()), deg[i] = e[i].size();
    queue<int> q;
    vector<int> vis(n);
    for (int i = 0; i < n; i++)
      if (deg[i] < k) vis[i] = 1, q.push(i);
    vector<int> clique;
    while (q.size()) {
      int u = q.front();
      q.pop();
      vis[u] = 2;
      if (deg[u] == k - 1 && clique.empty() && 1ll * k * (k - 1) / 2 <= m) {
        clique.push_back(u);
        for (auto v : e[u])
          if (vis[v] < 2) clique.push_back(v);
        bool ok = 1;
        for (auto x : clique)
          for (auto y : clique)
            if (x != y && !binary_search(e[x].begin(), e[x].end(), y)) ok = 0;
        if (!ok) clique.clear();
      }
      for (auto v : e[u])
        if (--deg[v] < k && !vis[v]) vis[v] = 1, q.push(v);
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) cnt += vis[i] == 0;
    if (cnt > 0) {
      cout << 1 << ' ' << cnt << '\n';
      for (int i = 0; i < n; i++)
        if (vis[i] == 0) cout << i + 1 << ' ';
      cout << '\n';
    } else if (clique.size()) {
      cout << 2 << '\n';
      for (auto t : clique) cout << t + 1 << ' ';
      cout << '\n';
    } else
      cout << -1 << '\n';
  }
  return 0;
}
