#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
const int N = 100005;
int n, m, k;
vector<int> adj[N];
int cnt[N];
int mark[N];
int pass;
int aux[N];
bool ta[N];
bool clique(int x) {
  pass++;
  mark[x] = pass;
  int id = 0;
  for (int i : adj[x])
    if (!ta[i]) {
      mark[i] = pass;
      aux[id++] = i;
    }
  for (int i = 0; i < id; i++) {
    for (int j = i + 1; j < id; j++) {
      if (!binary_search(adj[aux[i]].begin(), adj[aux[i]].end(), aux[j]))
        return 0;
    }
  }
  return 1;
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d %d %d", &n, &m, &k);
    for (int i = 1; i <= n; i++) {
      adj[i].clear();
      cnt[i] = 0;
      ta[i] = 0;
    }
    for (int i = 0; i < m; i++) {
      int a, b;
      scanf("%d %d", &a, &b);
      adj[a].push_back(b);
      adj[b].push_back(a);
      cnt[b]++;
      cnt[a]++;
    }
    for (int i = 1; i <= n; i++) {
      sort(adj[i].begin(), adj[i].end());
    }
    priority_queue<ii> pq;
    for (int i = 1; i <= n; i++) {
      pq.push({-cnt[i], i});
    }
    bool ok = 0;
    while (1) {
      if (pq.empty()) break;
      int c, x;
      tie(c, x) = pq.top();
      c = -c;
      if (c != cnt[x]) {
        pq.pop();
        continue;
      }
      if (c >= k) {
        vector<int> ans;
        while (!pq.empty()) {
          int c, x;
          tie(c, x) = pq.top();
          c = -c;
          pq.pop();
          if (c != cnt[x]) {
            continue;
          }
          ans.push_back(x);
        }
        printf("1 %d\n", (int)ans.size());
        for (int i : ans) {
          printf("%d ", i);
        }
        printf("\n");
        ok = 1;
        break;
      }
      pq.pop();
      if (c == k - 1) {
        if (clique(x)) {
          printf("2\n");
          printf("%d", x);
          for (int i : adj[x])
            if (!ta[i]) {
              printf(" %d", i);
            }
          printf("\n");
          ok = 1;
          break;
        }
      }
      cnt[x] = 0;
      ta[x] = 1;
      for (int i : adj[x])
        if (cnt[i]) {
          cnt[i]--;
          pq.push({-cnt[i], i});
        }
    }
    if (!ok) {
      printf("-1\n");
    }
  }
  return 0;
}
