#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const int N = 1e5 + 100;
int mark[N], deg[N], ct[N];
bool ans[N], can[N];
vector<int> v[N], A;
vector<pair<int, int> > ch[N];
bool cmp(int x, int y) { return mark[x] < mark[y]; }
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  A.clear();
  for (int i = 0; i <= n; i++)
    v[i].clear(), ch[i].clear(), mark[i] = deg[i] = ct[i] = 0,
                                 ans[i] = can[i] = false;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  if (k > 500) {
    cout << -1 << endl;
    return;
  }
  set<pair<int, int> > st;
  for (int i = 1; i <= n; i++) st.insert({deg[i] = (int)v[i].size(), i});
  int cnt = 1;
  while ((int)st.size()) {
    pair<int, int> p = *st.begin();
    if (p.first >= k) {
      cout << 1 << " " << (int)st.size() << endl;
      for (auto u : st) cout << u.second << " ";
      cout << endl;
      return;
    } else {
      st.erase(p);
      mark[p.second] = cnt;
      for (auto u : v[p.second])
        if (!mark[u]) st.erase({deg[u], u}), st.insert({--deg[u], u});
      A.push_back(p.second);
    }
    cnt++;
  }
  for (auto i : A) {
    int nxt = 0;
    for (auto u : v[i])
      if (mark[u] > mark[i]) ct[nxt++] = u, can[u] = true;
    for (auto u : ch[i])
      if (!can[u.first]) ans[u.second] = false;
    for (int j = 0; j < nxt; j++) can[ct[j]] = false;
    if (nxt != k - 1) continue;
    ans[i] = true;
    sort(ct, ct + nxt, cmp);
    for (int j = 0; j < nxt; j++)
      for (int k = j + 1; k < nxt; k++) ch[ct[j]].push_back({ct[k], i});
  }
  for (auto i : A) {
    if (!ans[i]) continue;
    cout << 2 << endl;
    cout << i << " ";
    for (auto u : v[i])
      if (mark[u] > mark[i]) cout << u << " ";
    cout << endl;
    return;
  }
  cout << -1 << endl;
  return;
}
int32_t main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
