#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int in[maxn];
bool vis[maxn];
struct node {
  int u;
  node(int u = 0) : u(u) {}
  bool operator<(const node& a) const { return in[a.u] < in[u]; }
};
vector<int> G[maxn];
priority_queue<node> que;
void init(int n) {
  while (!que.empty()) que.pop();
  for (int i = 1; i <= n; i++) {
    in[i] = 0, vis[i] = false;
    G[i].clear();
  }
}
void add(int u, int v) {
  G[u].push_back(v);
  G[v].push_back(u);
}
vector<int> a;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    init(n);
    for (int i = 1; i <= m; i++) {
      int u, v;
      scanf("%d%d", &u, &v);
      add(u, v);
      in[u]++, in[v]++;
    }
    if (1ll * k * (k - 1) > 2 * m) {
      printf("-1\n");
      continue;
    }
    for (int i = 1; i <= n; i++) {
      if (in[i] < k) que.push(i);
      sort(G[i].begin(), G[i].end());
    }
    int ok = 0, now = n;
    while (!que.empty()) {
      int u = que.top().u;
      que.pop();
      if (vis[u]) continue;
      if (in[u] == k - 1) {
        a.clear();
        int len = G[u].size();
        for (int i = 0; i < len; i++) {
          int v = G[u][i];
          if (vis[v]) continue;
          a.push_back(v);
        }
        ok = u;
        len = a.size();
        for (int i = 0; i < len && ok; i++) {
          for (int j = i + 1; j < len && ok; j++) {
            int l = a[i], r = a[j];
            if (!binary_search(G[l].begin(), G[l].end(), r)) {
              ok = 0;
              break;
            }
          }
        }
      }
      if (ok) {
        a.push_back(u);
        break;
      }
      int len = G[u].size();
      for (int i = 0; i < len; i++) {
        int v = G[u][i];
        if (vis[v]) continue;
        in[v]--;
        if (in[v] < k) que.push(v);
      }
      vis[u] = true;
      now--;
    }
    if (ok) {
      printf("2\n");
      for (int i = 0; i < k; i++) {
        printf("%d ", a[i]);
      }
      printf("\n");
    } else if (now) {
      printf("1 %d\n", now);
      for (int i = 1; i <= n; i++) {
        if (vis[i]) continue;
        printf("%d ", i);
      }
      printf("\n");
    } else
      printf("-1\n");
  }
  return 0;
}
