#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> deg(n);
    vector<vector<int>> adj(n);
    for (int i = 0, u, v; i < m; ++i) {
      cin >> u >> v;
      --u, --v;
      adj[u].push_back(v);
      adj[v].push_back(u);
      ++deg[u], ++deg[v];
    }
    deque<int> q;
    for (int i = 0; i < n; ++i) {
      sort(adj[i].begin(), adj[i].end());
      if (deg[i] == k - 1) q.push_back(i);
      if (deg[i] < k - 1) q.push_front(i);
    }
    vector<int> ans;
    vector<bool> mp(n);
    while (!q.empty()) {
      int u = q.front();
      q.pop_front();
      if (deg[u] == -1) continue;
      if (deg[u] == k - 1) {
        vector<int> &c = ans;
        for (auto v : adj[u])
          if (deg[v] != -1) {
            c.push_back(v);
            mp[v] = true;
          }
        c.insert(upper_bound(c.begin(), c.end(), u), u);
        mp[u] = true;
        bool ok = true;
        for (auto &i : c) {
          if (adj[i].size() <= 3 * c.size()) {
            int cnt = 0;
            for (auto j : adj[i]) cnt += mp[j];
            if (cnt != k - 1) {
              ok = false;
              break;
            }
          } else {
            for (size_t j = &i - &c[0]; ++j < c.size();) {
              auto it = lower_bound(adj[i].begin(), adj[i].end(), c[j]);
              if (it == adj[i].end() || *it != c[j]) {
                ok = false;
                break;
              }
            }
          }
        }
        if (ok) break;
        for (auto i : c) mp[i] = false;
        c.clear();
      }
      deg[u] = -1;
      for (auto v : adj[u])
        if (deg[v] != -1) {
          if (deg[v] == k - 1) q.push_front(v);
          if (deg[v] == k) q.push_back(v);
          --deg[v];
        }
    }
    if (ans.empty()) {
      for (int i = 0; i < n; ++i)
        if (deg[i] != -1) ans.push_back(i);
      if (!ans.empty()) {
        cout << "1 " << ans.size() << "\n";
        for (auto &i : ans) cout << i + 1 << " \n"[&i == &ans.back()];
      } else
        cout << "-1\n";
    } else {
      cout << "2\n";
      for (auto &i : ans) cout << i + 1 << " \n"[&i == &ans.back()];
    }
  }
  return 0;
}
