#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
const int Mod = 1e9 + 7;
const int N = 1e5 + 100;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
inline long long dpow(long long a, long long b) {
  long long r = 1, t = a;
  while (b) {
    if (b & 1) r = (r * t) % Mod;
    b >>= 1;
    t = (t * t) % Mod;
  }
  return r;
}
inline long long fpow(long long a, long long b) {
  long long r = 1, t = a;
  while (b) {
    if (b & 1) r = (r * t);
    b >>= 1;
    t = (t * t);
  }
  return r;
}
vector<int> G[N];
int dep[N], n, m, k;
int vis[N];
void Init() {
  for (int i = 1; i <= n; i++) {
    G[i].clear();
    vis[i] = dep[i] = 0;
  }
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    scanf("%d %d %d", &n, &m, &k);
    Init();
    for (int i = 0; i < m; i++) {
      int u, v;
      scanf("%d %d", &u, &v);
      G[u].push_back(v);
      G[v].push_back(u);
      dep[u]++, dep[v]++;
    }
    for (int i = 1; i <= n; i++) sort((G[i]).begin(), (G[i]).end());
    queue<int> q;
    vector<int> st;
    for (int i = 1; i <= n; i++) {
      if (dep[i] < k) q.push(i), vis[i] = 1;
    }
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      vis[u] = 2;
      if (dep[u] == k - 1 && st.empty() && 1ll * k * (k - 1) / 2 <= m) {
        st.push_back(u);
        for (auto v : G[u]) {
          if (vis[v] < 2) st.push_back(v);
        }
        bool ok = true;
        for (auto i : st) {
          for (auto j : st) {
            if (i != j && !binary_search((G[i]).begin(), (G[i]).end(), j))
              ok = false;
          }
        }
        if (!ok) st.clear();
      }
      for (auto v : G[u]) {
        dep[v]--;
        if (dep[v] < k && !vis[v]) q.push(v), vis[v] = 1;
      }
    }
    vector<int> ver;
    for (int i = 1; i <= n; i++) {
      if (!vis[i]) ver.push_back(i);
    }
    if (((int)(ver).size()) >= k) {
      printf("1 %d\n", ((int)(ver).size()));
      for (int i = 0; i < ((int)(ver).size()); i++)
        printf("%d%c", ver[i], " \n"[i == ((int)(ver).size()) - 1]);
    } else if (!st.empty()) {
      puts("2");
      for (auto v : st) printf("%d ", v);
      puts("");
    } else
      puts("-1");
  }
  return 0;
}
