#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<int>> G(n + 1);
    for (int i = 1; i <= m; i++) {
      int u, v;
      cin >> u >> v;
      G[u].push_back(v);
      G[v].push_back(u);
    }
    if (k == 1) {
      cout << "2\n";
      cout << "1\n";
      continue;
    }
    vector<int> deg(n + 1);
    vector<int> bad(n + 1);
    queue<int> Q;
    for (int i = 1; i <= n; i++) {
      sort(G[i].begin(), G[i].end());
      deg[i] = (int)G[i].size();
      if (deg[i] < k - 1) {
        Q.push(i);
        bad[i] = 1;
      }
    }
    while (!Q.empty()) {
      int cur = Q.front();
      assert(bad[cur] == 1);
      Q.pop();
      for (auto nx : G[cur]) {
        deg[nx] -= 1;
        if (!bad[nx] && deg[nx] < k - 1) {
          assert(deg[nx] == k - 2);
          Q.push(nx);
          bad[nx] = 1;
        }
      }
    }
    auto check = [&](const vector<int>& nodes) -> bool {
      for (auto v1 : nodes) {
        for (auto v2 : nodes) {
          if (v1 == v2) {
            continue;
          }
          auto it = lower_bound(G[v1].begin(), G[v1].end(), v2);
          if (it == G[v1].end()) {
            return false;
          }
          if (*it != v2) {
            return false;
          }
        }
      }
      return true;
    };
    auto find_clique = [&]() -> bool {
      for (int i = 1; i <= n; i++) {
        if (deg[i] == k - 1) {
          assert(bad[i] == 0);
          Q.push(i);
        }
      }
      while (!Q.empty()) {
        int cur = Q.front();
        Q.pop();
        assert(bad[cur] == 0);
        bad[cur] = 1;
        if (deg[cur] == k - 1) {
          vector<int> nodes;
          nodes.push_back(cur);
          for (auto nx : G[cur]) {
            if (bad[nx]) {
              continue;
            }
            nodes.push_back(nx);
          }
          assert(nodes.size() == k);
          if (check(nodes)) {
            cout << "2\n";
            for (auto v : nodes) {
              cout << v << " ";
            }
            cout << "\n";
            return true;
          }
        }
        for (auto nx : G[cur]) {
          deg[nx] -= 1;
          if (deg[nx] == k - 1) {
            Q.push(nx);
          }
        }
      }
      return false;
    };
    if (find_clique()) {
      continue;
    }
    vector<int> ans;
    for (int i = 1; i <= n; i++) {
      if (!bad[i]) {
        ans.push_back(i);
      }
    }
    if (ans.empty()) {
      cout << "-1\n";
    } else {
      cout << "1 " << ans.size() << "\n";
      for (auto v : ans) {
        cout << v << " ";
      }
      cout << "\n";
    }
  ddd:;
  }
  return 0;
}
