#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<int>> g(n);
  vector<int> sz(n), used(n);
  unordered_set<long long> con;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
    sz[a]++, sz[b]++;
    con.insert(a * n + b);
    con.insert(b * n + a);
  }
  set<pair<int, int>> st;
  for (int i = 0; i < n; ++i) st.insert({(int)g[i].size(), i});
  vector<vector<int>> lol;
  while (!st.empty() && st.begin()->first < k) {
    int v = st.begin()->second;
    used[v] = 1;
    st.erase(st.begin());
    if (sz[v] == k - 1) {
      vector<int> kek = {v};
      for (int j : g[v])
        if (!used[j]) kek.push_back(j);
      lol.push_back(kek);
    }
    for (int i : g[v]) {
      if (!used[i]) {
        st.erase({sz[i], i});
        sz[i]--;
        st.insert({sz[i], i});
      }
    }
  }
  if (!st.empty()) {
    cout << "1 " << st.size() << '\n';
    for (auto &i : st) cout << i.second + 1 << ' ';
    cout << '\n';
    return;
  }
  for (auto &comp : lol) {
    bool ok = true;
    for (int i = 0; i < comp.size() && ok; ++i)
      for (int j = i + 1; j < comp.size() && ok; ++j)
        if (con.find(comp[i] * n + comp[j]) == con.end()) ok = false;
    if (ok) {
      cout << "2\n";
      for (int j : comp) cout << j + 1 << ' ';
      cout << '\n';
      return;
    }
  }
  cout << "-1\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
