#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;
unordered_set<int> adj[N];
int vis[N];
void init(int n) {
  for (int i = 0; i <= n; i++) {
    adj[i].clear();
    vis[i] = 0;
  }
}
vector<int> v2;
bool tmam() {
  for (int i = 0; i < (int)v2.size(); i++) {
    for (int j = i + 1; j < (int)v2.size(); j++) {
      if (adj[v2[i]].find(v2[j]) == adj[v2[i]].end()) return 0;
    }
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    int n, m, k;
    cin >> n >> m >> k;
    init(n);
    for (int i = 0; i < m; i++) {
      int u, v;
      cin >> u >> v;
      u--;
      v--;
      adj[u].insert(v);
      adj[v].insert(u);
    }
    if (1ll * k * (k - 1) / 2 > m) {
      cout << -1 << '\n';
      continue;
    }
    v2 = vector<int>(k - 1);
    vector<int> v;
    for (int i = 0; i < n; i++) {
      if (adj[i].size() + 1 < k) {
        v.push_back(i);
        vis[i] = 1;
      }
    }
    for (int i = 0; i < (int)v.size(); i++) {
      int node = v[i];
      for (auto j : adj[node]) {
        adj[j].erase(node);
        if (adj[j].size() + 1 < k && vis[j] == 0) {
          vis[j] = 1;
          v.push_back(j);
        }
      }
    }
    v.clear();
    unordered_set<int> ans;
    for (int i = 0; i < n; i++) {
      if (adj[i].size() + 1 == k) {
        v.push_back(i);
      }
    }
    for (int i = 0; i < (int)v.size(); i++) {
      int node = v[i];
      if (adj[node].size() + 1 == k) {
        int idx = 0;
        for (auto i : adj[node]) {
          v2[idx++] = i;
        }
        if (tmam()) {
          ans = adj[node];
          ans.insert(node);
          break;
        }
      }
      for (auto j : adj[node]) {
        adj[j].erase(node);
        if (adj[j].size() + 1 == k) {
          v.push_back(j);
        }
      }
      adj[node].clear();
    }
    if (ans.size()) {
      cout << 2 << '\n';
      for (auto i : ans) cout << i + 1 << ' ';
      cout << '\n';
      continue;
    }
    for (int i = 0; i < n; i++) {
      if (adj[i].size() >= k) {
        ans.insert(i);
      }
    }
    if (ans.size()) {
      cout << 1 << ' ' << (int)ans.size() << '\n';
      for (auto i : ans) cout << i + 1 << ' ';
    } else
      cout << -1;
    cout << '\n';
  }
  return 0;
}
