#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
vector<int> v[N];
unordered_set<int> edges[N];
bool instack[N];
int deg[N];
void solve() {
  int n, m, r;
  scanf("%d%d%d", &n, &m, &r);
  for (int i = 1; i <= n; i++) {
    v[i].clear();
    deg[i] = 0;
    instack[i] = true;
    edges[i].clear();
  }
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    deg[x]++, deg[y]++;
    v[x].push_back(y);
    v[y].push_back(x);
    edges[x].insert(y);
    edges[y].insert(x);
  }
  set<pair<int, int> > st;
  for (int i = 1; i <= n; i++) st.insert(make_pair(deg[i], i));
  while (!st.empty() && st.begin()->first < r) {
    int x = st.begin()->second;
    st.erase(*st.begin());
    instack[x] = false;
    for (int i = 0; i < v[x].size(); i++) {
      int y = v[x][i];
      if (!instack[y]) continue;
      st.erase(make_pair(deg[y], y));
      deg[y]--;
      st.insert(make_pair(deg[y], y));
    }
  }
  if (st.size()) {
    printf("1 %d\n", int(st.size()));
    for (set<pair<int, int> >::iterator it = st.begin(); it != st.end(); it++)
      printf("%d ", it->second);
    printf("\n");
    return;
  }
  if (1LL * r * (r - 1) / 2 > m) {
    printf("-1\n");
    return;
  }
  st.clear();
  for (int i = 1; i <= n; i++) {
    deg[i] = v[i].size();
    instack[i] = true;
    st.insert(make_pair(deg[i], i));
  }
  while (!st.empty() && st.begin()->first < r - 1) {
    int x = st.begin()->second;
    instack[x] = false;
    st.erase(*st.begin());
    for (int i = 0; i < v[x].size(); i++) {
      int y = v[x][i];
      if (!instack[y]) continue;
      st.erase(make_pair(deg[y], y));
      deg[y]--;
      st.insert(make_pair(deg[y], y));
    }
  }
  if (st.size() < r) {
    printf("-1\n");
    return;
  }
  while (st.size() >= r) {
    int x = st.begin()->second;
    int y = st.begin()->first;
    instack[x] = false;
    vector<int> tmp;
    for (int i = 0; i < v[x].size() && y == r - 1; i++)
      if (instack[v[x][i]]) {
        tmp.push_back(v[x][i]);
      }
    tmp.push_back(x);
    bool flag = true;
    for (int i = 0; i < tmp.size() && flag && y == r - 1; i++) {
      int t = tmp[i];
      for (int j = i + 1; j < tmp.size() && flag; j++) {
        int p = tmp[j];
        if (!edges[t].count(p)) {
          flag = false;
          break;
        }
      }
    }
    if (flag && y == r - 1) {
      printf("2\n");
      for (int i = 0; i < tmp.size(); i++) printf("%d ", tmp[i]);
      printf("\n");
      return;
    }
    st.erase(*st.begin());
    for (int i = 0; i < v[x].size(); i++) {
      y = v[x][i];
      if (!instack[y]) continue;
      st.erase(make_pair(deg[y], y));
      deg[y]--;
      st.insert(make_pair(deg[y], y));
    }
  }
  printf("-1\n");
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
  return 0;
}
