#include <bits/stdc++.h>
using namespace std;
long double PI = 3.14159265359;
int inf = 1000000000000000007;
int mod = 1000000007;
int mod1 = 998244353;
const bool multi = 1;
vector<int> G[100007];
int deg[100007];
unordered_map<int, bool> is[100007];
bool odw[100007];
int n;
vector<int> check(int k) {
  memset(odw, 0, sizeof odw);
  deque<int> Q;
  for (int i = 1; i <= n; i++) {
    deg[i] = (int)(G[i]).size();
    if (deg[i] < k) {
      odw[i] = 1;
      Q.push_back(i);
    }
  }
  while (!Q.empty()) {
    int v = Q[0];
    Q.pop_front();
    for (auto u : G[v]) {
      deg[u]--;
      if (!odw[u] && deg[u] < k) {
        odw[u] = 1;
        Q.push_back(u);
      }
    }
  }
  vector<int> res;
  for (int i = 1; i <= n; i++)
    if (!odw[i]) res.push_back(i);
  return res;
}
bool is_clique(vector<int> xd, int k) {
  if ((int)(xd).size() != k) return 0;
  bool ok = 1;
  for (int i = 0; i < (int)(xd).size(); i++) {
    for (int j = i + 1; j < (int)(xd).size(); j++) {
      ok &= is[xd[i]][xd[j]];
    }
  }
  return ok;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tt;
  if (multi)
    cin >> tt;
  else
    tt = 1;
  while (tt--) {
    int m, k, a, b;
    cin >> n >> m >> k;
    for (int i = 0; i < m; i++) {
      cin >> a >> b;
      G[a].push_back(b);
      G[b].push_back(a);
      is[a][b] = 1;
      is[b][a] = 1;
    }
    vector<int> xd = check(k);
    if ((int)(xd).size() > 0) {
      cout << 1 << " " << (int)(xd).size() << '\n';
      for (auto x : xd) cout << x << " ";
      cout << '\n';
    } else {
      xd = check(k - 1);
      if ((int)(xd).size() > 0) {
        deque<int> Q;
        for (auto x : xd)
          if (deg[x] == k - 1) Q.push_back(x);
        bool ok = 0;
        while ((int)(Q).size() > 0) {
          int v = Q[0];
          odw[v] = 1;
          Q.pop_front();
          vector<int> c;
          c.push_back(v);
          for (auto u : G[v]) {
            if (odw[u]) continue;
            c.push_back(u);
            deg[u]--;
            if (deg[u] == k - 1) Q.push_back(u);
          }
          if (is_clique(c, k)) {
            cout << 2 << '\n';
            for (auto x : c) cout << x << " ";
            cout << '\n';
            ok = 1;
            break;
          }
        }
        if (!ok) cout << -1 << '\n';
      } else
        cout << -1 << '\n';
    }
    for (int i = 1; i <= n; i++) {
      G[i].clear();
      is[i].clear();
    }
  }
  return 0;
}
