#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
vector<int> G[maxn], clique;
int d[maxn], n, vis[maxn], vis1[maxn];
void deal(int k) {
  queue<int> q;
  for (int i = 1; i <= n; i++) {
    if (d[i] < k) {
      q.push(i);
      vis[i] = 1;
    }
  }
  bool flag = false;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    vis[u] = 1;
    if (d[u] == k - 1) {
      clique.clear();
      clique.push_back(u);
      for (int i = 0; i < G[u].size(); i++) {
        int v = G[u][i];
        if (vis1[v]) continue;
        clique.push_back(v);
      }
      bool tem = false;
      for (int i = 0; i < clique.size(); i++) {
        for (int j = 0; j < clique.size(); j++) {
          if (clique[i] == clique[j]) break;
          if (!binary_search(G[clique[i]].begin(), G[clique[i]].end(),
                             clique[j])) {
            tem = true;
          }
        }
      }
      if (!tem) {
        flag = true;
        break;
      }
      clique.clear();
    }
    vis1[u] = 1;
    for (int i = 0; i < G[u].size(); i++) {
      int v = G[u][i];
      d[v]--;
      if (vis[v]) continue;
      if (d[v] < k) {
        vis[v] = 1;
        q.push(v);
      }
    }
  }
  if (flag) {
    printf("2\n");
    for (int i = 0; i < clique.size(); i++) printf("%d ", clique[i]);
  } else {
    int cnt = 0;
    for (int i = 1; i <= n; i++)
      if (!vis[i]) cnt++;
    if (cnt > 0) {
      printf("1 %d\n", cnt);
      for (int i = 1; i <= n; i++) {
        if (!vis[i]) printf("%d ", i);
      }
    } else
      printf("-1");
  }
  printf("\n");
}
void Init() {
  for (int i = 1; i <= n; i++) {
    G[i].clear();
    vis[i] = vis1[i] = 0;
    d[i] = 0;
  }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int m, k;
    scanf("%d%d%d", &n, &m, &k);
    Init();
    for (int i = 1, u, v; i <= m; i++) {
      scanf("%d%d", &u, &v);
      G[u].push_back(v);
      G[v].push_back(u);
    }
    if (k * (k - 1) > 2 * m) {
      printf("-1\n");
      continue;
    }
    for (int i = 1; i <= n; i++) {
      d[i] = G[i].size();
      sort(G[i].begin(), G[i].end());
    }
    deal(k);
  }
}
