#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
const int maxn = 1e5 + 2000;
int n, m, k, u, v;
vector<int> g[maxn], clique;
queue<int> q;
int d[maxn], vis[maxn];
void init() {
  for (int i = 1; i <= n; i++) g[i].clear(), d[i] = 0, vis[i] = 0;
  while (!q.empty()) q.pop();
  clique.clear();
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    cin >> n >> m >> k;
    init();
    for (int i = 1; i <= m; i++)
      scanf("%d%d", &u, &v), g[u].push_back(v), g[v].push_back(u);
    for (int i = 1; i <= n; i++)
      sort(g[i].begin(), g[i].end()), d[i] = (int)g[i].size();
    for (int i = 1; i <= n; i++)
      if (d[i] < k) vis[i] = 1, q.push(i);
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      vis[u] = 2;
      if (d[u] == k - 1 && clique.empty()) {
        clique.push_back(u);
        for (auto v : g[u])
          if (vis[v] != 2) clique.push_back(v);
        bool flag = 1;
        for (auto x : clique)
          for (auto y : clique)
            if (x != y && !binary_search(g[x].begin(), g[x].end(), y)) flag = 0;
        if (!flag) clique.clear();
      }
      for (auto v : g[u]) {
        d[v]--;
        if (!vis[v] && d[v] < k) vis[v] = 1, q.push(v);
      }
    }
    int ans = 0;
    for (int i = 1; i <= n; i++)
      if (!vis[i]) ans++;
    if (ans) {
      printf("1 %d\n", ans);
      for (int i = 1; i <= n; i++)
        if (!vis[i]) printf("%d ", i);
      printf("\n");
    } else if (!clique.empty()) {
      printf("2\n");
      for (auto x : clique) printf("%d ", x);
      printf("\n");
    } else
      printf("-1\n");
  }
}
