#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
const int MAX = 1e5 + 5;
int N, M, K;
vector<int> G[MAX];
int in[MAX];
bool vis[MAX], del[MAX];
bool chk(int x) {
  vector<int> v;
  v.emplace_back(x);
  for (auto& y : G[x])
    if (!del[y]) v.emplace_back(y);
  for (int i = 0; i < (int)(v.size()); i++) {
    for (int j = i + 1; j < (int)(v.size()); j++) {
      int a = v[i], b = v[j];
      if (!binary_search((G[a]).begin(), (G[a]).end(), b)) return 0;
    }
  }
  return 1;
}
void solve() {
  cin >> N >> M >> K;
  for (int i = 1; i <= N; i++) {
    G[i].clear();
    vis[i] = in[i] = del[i] = 0;
  }
  for (int i = 1; i <= M; i++) {
    int u, v;
    cin >> u >> v;
    G[u].emplace_back(v);
    G[v].emplace_back(u);
    in[u]++, in[v]++;
  }
  for (int i = 1; i <= N; i++) sort((G[i]).begin(), (G[i]).end());
  queue<int> q;
  for (int i = 1; i <= N; i++) {
    if (in[i] <= K - 1) {
      q.push(i);
      vis[i] = 1;
    }
  }
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    if (1LL * K * (K - 1) <= 2 * M && in[x] == K - 1) {
      if (chk(x)) {
        cout << 2 << '\n';
        cout << x << ' ';
        for (auto& y : G[x])
          if (!del[y]) cout << y << ' ';
        cout << '\n';
        return;
      }
    }
    del[x] = 1;
    for (auto& y : G[x]) {
      in[y]--;
      if (in[y] <= K - 1 && !vis[y]) q.push(y), vis[y] = 1;
    }
  }
  vector<int> v;
  for (int i = 1; i <= N; i++)
    if (!del[i]) v.push_back(i);
  if ((int)(v.size())) {
    cout << 1 << ' ' << (int)(v.size()) << '\n';
    for (auto& x : v) cout << x << ' ';
    cout << '\n';
    return;
  }
  cout << -1 << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) solve();
  return 0;
}
