#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
vector<vector<long long> > g;
vector<long long> num, u;
unordered_set<long long> S;
bool click(int v) {
  vector<long long> z;
  for (auto to : g[v])
    if (u[to]) z.push_back(to);
  for (int i = 0; i < z.size(); ++i) {
    for (int j = 0; j < i; ++j) {
      long long a = z[i];
      long long b = z[j];
      if (a > b) swap(a, b);
      if (!S.count((a << 20) ^ b)) return false;
    }
  }
  return true;
}
void f() {
  cin >> n >> m >> k;
  g.clear();
  g.resize(n);
  S.clear();
  for (int i = 0; i < m; ++i) {
    long long a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
    if (a > b) swap(a, b);
    S.insert((a << 20) ^ b);
  }
  if (k >= 500) {
    cout << "-1\n";
    return;
  }
  num.resize(n);
  u.assign(n, 1);
  set<int> se;
  for (int i = 0; i < n; ++i) {
    num[i] = g[i].size();
    if (num[i] < k) {
      se.insert(i);
      u[i] = 0;
    }
  }
  while (!se.empty()) {
    int v = *se.begin();
    se.erase(se.begin());
    for (auto to : g[v]) {
      --num[to];
      if (!u[to]) continue;
      if (num[to] < k) {
        se.insert(to);
        u[to] = 0;
      }
    }
  }
  int al = accumulate(u.begin(), u.end(), 0);
  if (al > 0) {
    cout << 1 << " " << al << "\n";
    for (int i = 0; i < n; ++i)
      if (u[i]) cout << i + 1 << " ";
    cout << "\n";
    return;
  }
  u.assign(n, 1);
  se.clear();
  for (int i = 0; i < n; ++i) {
    num[i] = g[i].size();
    if (num[i] < k - 1) {
      se.insert(i);
      u[i] = 0;
    }
  }
  while (!se.empty()) {
    int v = *se.begin();
    se.erase(se.begin());
    for (auto to : g[v]) {
      --num[to];
      if (!u[to]) continue;
      if (num[to] < k - 1) {
        se.insert(to);
        u[to] = 0;
      }
    }
  }
  al = accumulate(u.begin(), u.end(), 0);
  if (al == 0) {
    cout << "-1\n";
    return;
  }
  for (int i = 0; i < n; ++i)
    if (num[i] == k - 1) se.insert(i);
  long long lim = (k * (k - 1)) / 2;
  while (!se.empty() && S.size() >= lim) {
    int v = *se.begin();
    se.erase(se.begin());
    if (num[v] == k - 1 && click(v)) {
      cout << 2 << "\n";
      cout << v + 1 << " ";
      for (auto to : g[v])
        if (u[to]) cout << to + 1 << " ";
      cout << "\n";
      return;
    }
    u[v] = 0;
    for (auto to : g[v]) {
      long long a = v;
      long long b = to;
      if (a > b) swap(a, b);
      S.erase((a << 20) ^ b);
      --num[to];
      if (!u[to]) continue;
      if (num[to] <= k - 1) se.insert(to);
    }
  }
  cout << "-1\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) f();
  return 0;
}
