#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const long long inff = 0x3f3f3f3f3f3f3f3f;
const int N = 1e5 + 8;
int n, m, t, k, x, y, du[N], vis[N], sz[N], ans[N];
list<int> g[N];
pair<int, int> a[N];
unordered_map<int, int> mp[N];
int main() {
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    scanf("%d", &n), scanf("%d", &m), scanf("%d", &k);
    for (int i(1); i <= (n); ++i) g[i].clear(), vis[i] = du[i] = 0;
    queue<int> q;
    for (int i(1); i <= (m); ++i) {
      scanf("%d", &x), scanf("%d", &y);
      du[x]++, du[y]++;
      g[x].push_back(y);
      g[y].push_back(x);
      a[i].first = x, a[i].second = y;
    }
    int num = 0;
    for (int i(1); i <= (n); ++i)
      if (du[i] < k) q.push(i), vis[i] = 1, num++;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      for (auto it : g[u]) {
        int v = it;
        if (vis[v]) continue;
        du[v]--;
        if (du[v] < k) q.push(v), vis[v] = 1, num++;
      }
    }
    if (num != n) {
      int ans = 0;
      for (int i(1); i <= (n); ++i) ans += (vis[i] == 0);
      printf("1 %d\n", ans);
      for (int i(1); i <= (n); ++i)
        if (!vis[i]) printf("%d ", i);
      puts("");
      continue;
    }
    if (1ll * k * (k - 1) / 2 > m) {
      puts("-1");
      continue;
    }
    --k;
    for (int i(1); i <= (n); ++i) vis[i] = du[i] = 0;
    for (int i(1); i <= (m); ++i) du[a[i].first]++, du[a[i].second]++;
    for (int i(1); i <= (n); ++i)
      if (du[i] < k) q.push(i), vis[i] = 1, num++;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      for (auto it : g[u]) {
        int v = it;
        if (vis[v]) continue;
        du[v]--;
        if (du[v] < k) q.push(v), vis[v] = 1, num++;
      }
    }
    for (int i(1); i <= (n); ++i) g[i].clear(), du[i] = 0, mp[i].clear();
    for (int i(1); i <= (m); ++i) {
      x = a[i].first, y = a[i].second;
      if (vis[x] || vis[y]) continue;
      g[x].push_back(y);
      g[y].push_back(x);
      mp[x][y] = mp[y][x] = 1;
      du[x]++, du[y]++;
    }
    for (int i(1); i <= (n); ++i) vis[i] = 0;
    for (int i(1); i <= (n); ++i)
      if (du[i] == k) q.push(i), vis[i] = 1;
    int flag = 0;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      if (du[u] == k) flag = 1, num = 0, ans[++num] = u;
      for (auto it : g[u]) {
        int v = it;
        du[v]--;
        if (flag && vis[v] != 2) ans[++num] = v;
        if (vis[v]) continue;
        if (du[v] == k) q.push(v), vis[v] = 1;
      }
      srand(time(0));
      vis[u] = 2;
      if (flag) {
        for (int i(1); i <= (num); ++i)
          if (du[ans[i]] < k - 1) flag = 0;
        if (!flag) continue;
        random_shuffle(ans + 1, ans + num + 1);
        for (int i(1); i <= (num); ++i) {
          for (int j(i + 1); j <= (num); ++j)
            if (mp[ans[i]].find(ans[j]) == mp[ans[i]].end()) {
              flag = 0;
              break;
            }
          if (!flag) break;
        }
        if (flag) break;
      }
    }
    while (!q.empty()) q.pop();
    if (flag) {
      puts("2");
      for (int i(1); i <= (num - 1); ++i) printf("%d ", ans[i]);
      printf("%d\n", ans[num]);
    } else
      puts("-1");
  }
  return 0;
}
