#include <bits/stdc++.h>
using namespace std;
int T, n, m, k;
unordered_set<int> g[100003];
vector<int> ans;
int sol() {
  bool kans = 0;
  ans.clear();
  priority_queue<pair<int, int> > q;
  for (int i = 1; i <= n; ++i) {
    q.push(make_pair(-g[i].size(), i));
  }
  while (!q.empty()) {
    int t = q.top().second;
    q.pop();
    if (g[t].empty()) continue;
    if (g[t].size() >= k) {
      kans = 1;
      break;
    }
    if (g[t].size() == k - 1 && k * (k - 1ll) / 2 <= m) {
      bool f = 1;
      for (auto p = g[t].begin(); f && p != g[t].end(); ++p)
        for (auto q = p; f && ++q != g[t].end();)
          f &= g[*p].find(*q) != g[*p].end();
      if (f) {
        ans.push_back(t);
        ans.insert(ans.end(), g[t].begin(), g[t].end());
        break;
      }
    }
    for (auto p : g[t]) {
      g[p].erase(t);
      q.push(make_pair(-g[p].size(), p));
    }
    g[t].clear();
  }
  if (ans.size()) {
    return 2;
  } else if (kans) {
    for (int i = 1; i <= n; ++i)
      if (g[i].size()) ans.push_back(i);
    return 1;
  }
  return -1;
}
int main() {
  ios::sync_with_stdio(0);
  for (cin >> T; T; --T) {
    cin >> n >> m >> k;
    for (int i = 1; i <= n; ++i) g[i].clear();
    for (int i = 1; i <= m; ++i) {
      int p, q;
      cin >> p >> q;
      g[p].insert(q);
      g[q].insert(p);
    }
    int ret = sol();
    if (ret == 2) {
      cout << 2 << '\n';
      for (auto t : ans) cout << t << ' ';
      cout << endl;
    } else if (ret == 1) {
      cout << 1 << ' ' << ans.size() << '\n';
      for (auto t : ans) cout << t << ' ';
      cout << endl;
    } else
      cout << -1 << endl;
  }
  return 0;
}
