#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <class A, class B>
ostream& operator<<(ostream& out, const pair<A, B>& a) {
  return out << "(" << a.first << ", " << a.second << ")";
}
template <int>
ostream& operator<<(ostream& os, const vector<int>& v) {
  os << "[";
  for (int i = 0; i < v.size(); ++i) {
    if (v[i] != 1000000001)
      os << v[i];
    else
      os << "INF";
    if (i != v.size() - 1) os << ", ";
  }
  os << "]\n";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[";
  for (int i = 0; i < v.size(); ++i) {
    os << v[i];
    ;
    if (i != v.size() - 1) os << ", ";
  }
  os << "]\n";
  return os;
}
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  unordered_set<int> adj[n], adjEdge[n];
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    adj[a].insert(b);
    adj[b].insert(a);
    adjEdge[a].insert(b);
    adjEdge[b].insert(a);
  }
  set<pair<int, int> > degVertex;
  int vertexDegMap[n];
  set<int> vertices;
  for (int i = 0; i < n; i++) {
    vertices.insert(i);
    vertexDegMap[i] = adj[i].size();
    degVertex.insert(make_pair(adj[i].size(), i));
  }
  if (1LL * k * (k - 1) > 2 * m) {
    cout << -1 << endl;
    return;
  }
  vector<int> candidates[n];
  while (!degVertex.empty() && (*degVertex.begin()).first < k) {
    pair<int, int> p = *degVertex.begin();
    int vert = p.second, deg = p.first;
    if (deg == k - 1) {
      for (auto v : adj[vert]) {
        if (!vertices.count(v)) continue;
        candidates[vert].push_back(v);
      }
      candidates[vert].push_back(vert);
    }
    for (auto v : adj[vert]) {
      int degV = vertexDegMap[v];
      degVertex.erase(make_pair(degV, v));
      vertexDegMap[v]--;
      adj[v].erase(vert);
      if (vertexDegMap[v] != 0) {
        degVertex.insert(make_pair(degV - 1, v));
      } else
        vertices.erase(v);
    }
    degVertex.erase(p);
    vertices.erase(vert);
    adj[vert].clear();
  }
  if (vertices.empty()) {
    for (int i = 0; i < n; i++) {
      if (candidates[i].size() != k) continue;
      int vert = i;
      bool flag = true;
      for (auto v : candidates[vert]) {
        for (auto w : candidates[vert]) {
          if (v == w) continue;
          if ((adjEdge[v].find(w) == adjEdge[v].end())) {
            flag = false;
            break;
          }
        }
        if (!flag) break;
      }
      if (flag) {
        cout << 2 << endl;
        for (auto v : candidates[vert]) cout << v + 1 << " ";
        cout << endl;
        return;
      }
    }
    cout << -1 << endl;
  } else {
    cout << 1 << " " << vertices.size() << endl;
    for (auto v : vertices) cout << v + 1 << " ";
    cout << endl;
  }
}
int main() {
  {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  };
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
