#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
mt19937 rnd(time(nullptr));
const int N = 1e5 + 5;
unordered_set<int> g[N];
bool check(int v) {
  for (auto i : g[v])
    for (auto j : g[v])
      if (i != j && !g[i].count(j)) return false;
  cout << "2\n" << v << " ";
  for (auto i : g[v]) cout << i << " ";
  cout << "\n";
  return true;
}
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) g[i].clear();
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    g[u].insert(v), g[v].insert(u);
  }
  set<pair<int, int> > st;
  for (int i = 1; i <= n; ++i) {
    st.insert({g[i].size(), i});
  }
  if ((long long)k * (k - 1) > 2 * m) {
    cout << "-1\n";
    return;
  }
  while (st.size()) {
    pair<int, int> v = *st.begin();
    if (v.first >= k) break;
    if (v.first == k - 1 && check(v.second)) return;
    st.erase(st.begin());
    for (auto to : g[v.second]) {
      st.erase({g[to].size(), to});
      g[to].erase(v.second);
      st.insert({g[to].size(), to});
    }
  }
  if (st.size()) {
    cout << "1 " << st.size() << "\n";
    for (auto v : st) cout << v.second << " ";
    cout << "\n";
  } else
    cout << "-1\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
}
