#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  long long s = 0, w = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * w;
}
int T;
int n, m, k;
vector<int> e[200010];
int deg[200010], d[200010], vis[200010];
unordered_map<int, int> ma[200010];
vector<int> ans;
int flag2;
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    Q;
inline void check(int x) {
  if (flag2) return;
  vector<int> v;
  for (int y : e[x])
    if (!vis[y]) v.push_back(y);
  int tmp = v.size();
  int flag = 1;
  for (register int i = 0; i <= tmp - 1; i++)
    for (register int j = i + 1; j <= tmp - 1; j++)
      if (!ma[v[i]][v[j]]) {
        flag = 0;
        break;
      }
  if (flag) {
    flag2 = 1;
    ans.push_back(x);
    for (int y : v) ans.push_back(y);
  }
}
inline int Solve() {
  while (!Q.empty()) Q.pop();
  for (register int i = 1; i <= n; i++)
    d[i] = deg[i], Q.push(make_pair(d[i], i));
  int flag = 0;
  while (!Q.empty()) {
    int x = Q.top().second, val = Q.top().first;
    Q.pop();
    if (d[x] != val || vis[x]) continue;
    vis[x] = 1;
    if (d[x] >= k) {
      flag = 1;
      break;
    } else if (d[x] == k - 1)
      check(x);
    for (int y : e[x]) {
      if (!vis[y]) d[y]--, Q.push(make_pair(d[y], y));
    }
  }
  return flag;
}
int main() {
  T = read();
  while (T--) {
    flag2 = 0;
    ans.clear();
    n = read(), m = read(), k = read();
    for (register int i = 1; i <= n; i++)
      e[i].clear(), deg[i] = 0, ma[i].clear(), vis[i] = 0;
    for (register int i = 1; i <= m; i++) {
      int x = read(), y = read();
      e[x].push_back(y), e[y].push_back(x);
      deg[x]++, deg[y]++;
      ma[x][y] = ma[y][x] = 1;
    }
    if (k * (k - 1) / 2 > m) {
      puts("-1");
      continue;
    }
    if (Solve()) {
      vector<int> answer;
      for (register int i = 1; i <= n; i++)
        if (d[i] >= k) answer.push_back(i);
      printf("1 %d\n", (int)answer.size());
      for (int x : answer) printf("%d ", x);
      puts("");
      continue;
    }
    if (flag2) {
      puts("2");
      for (int x : ans) printf("%d ", x);
      puts("");
    } else
      puts("-1");
  }
  return 0;
}
