#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int randi = uniform_int_distribution<int>(0, 10)(rng);
const int N = 1e5 + 5;
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  unordered_set<int> g[n];
  unordered_set<int> g2[n];
  for (int i = 0; i < m; i++) {
    int v, u;
    cin >> v >> u;
    v--, u--;
    g[v].insert(u);
    g[u].insert(v);
    g2[v].insert(u);
    g2[u].insert(v);
  }
  set<pair<int, int>> s;
  for (int i = 0; i < n; i++) {
    s.insert({g2[i].size(), i});
  }
  vector<vector<int>> cands;
  while (!s.empty()) {
    auto fi = s.begin();
    int v = fi->second;
    s.erase(fi);
    if (g2[v].size() < k - 1) {
      for (const int &u : g2[v]) {
        s.erase({g2[u].size(), u});
        g2[u].erase(v);
        s.insert({g2[u].size(), u});
      }
    } else if (g2[v].size() == k - 1) {
      vector<int> c;
      c.reserve(k);
      c.push_back(v);
      for (const int &u : g2[v]) {
        c.push_back(u);
        s.erase({g2[u].size(), u});
        g2[u].erase(v);
        s.insert({g2[u].size(), u});
      }
      cands.push_back(c);
    } else {
      cout << 1 << " " << (1 + s.size()) << "\n";
      cout << (v + 1) << " ";
      for (const auto &p : s) {
        cout << (p.second + 1) << " ";
      }
      cout << "\n";
      return;
    }
  }
  for (const vector<int> &c : cands) {
    bool flag = true;
    for (int i = 0; i < c.size(); i++) {
      for (int j = i + 1; j < c.size(); j++) {
        int v = c[i], u = c[j];
        if (g[v].find(u) == g[v].end()) {
          flag = false;
          break;
        }
      }
      if (!flag) break;
    }
    if (flag) {
      cout << 2 << "\n";
      for (const int &v : c) {
        cout << (v + 1) << " ";
      }
      cout << "\n";
      return;
    }
  }
  cout << -1 << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  chrono::steady_clock::time_point begin = chrono::steady_clock::now();
  int tests = 1;
  cin >> tests;
  while (tests--) {
    solve();
  }
  chrono::steady_clock::time_point end = chrono::steady_clock::now();
  return 0;
}
