#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  set<int> adj[n + 1];
  unordered_set<int> check[n + 1];
  for (long long i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].insert(b);
    adj[b].insert(a);
    check[a].insert(b);
    check[b].insert(a);
  }
  set<pair<int, int> > adjs;
  for (long long i = 1; i < n + 1; i++) adjs.insert({adj[i].size(), i});
  while (!adjs.empty()) {
    auto bro = *(adjs.begin());
    adjs.erase(adjs.begin());
    if (bro.first >= k) {
      vector<int> ans;
      for (long long i = 1; i < n + 1; i++)
        if (adj[i].size() > 0) ans.push_back(i);
      cout << 1 << " " << ans.size() << "\n";
      for (auto j : ans) cout << j << " ";
      cout << "\n";
      return;
    }
    if (bro.first == k - 1) {
      vector<int> ans;
      ans.push_back(bro.second);
      for (auto j : adj[bro.second]) ans.push_back(j);
      assert(ans.size() == k);
      bool hey = true;
      for (long long i = 0; i < k; i++)
        for (long long j = i + 1; j < k; j++)
          if (check[ans[i]].find(ans[j]) == check[ans[i]].end()) {
            hey = false;
            break;
          }
      if (hey) {
        cout << 2 << "\n";
        for (auto j : ans) cout << j << " ";
        cout << "\n";
        return;
      }
    }
    for (auto j : adj[bro.second]) {
      adjs.erase({adj[j].size(), j});
      adj[j].erase(bro.second);
      adjs.insert({adj[j].size(), j});
    }
    adj[bro.second].clear();
  }
  cout << "-1"
       << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
