#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
unordered_set<int> has[maxn];
set<pair<int, int> > st;
vector<int> chk;
int t, n, m, k, del[maxn], d[maxn], vis[maxn];
vector<int> E[maxn];
bool solved;
inline int read() {
  int num = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) {
    num = (num << 3) + (num << 1) + (ch ^ 48);
    ch = getchar();
  }
  return w ? -num : num;
}
bool check() {
  if (chk.size() != k) return 0;
  for (int i = 0; i < k; ++i) {
    for (int j = i + 1; j < k; ++j) {
      int u = chk[i], v = chk[j];
      if (!has[u].count(v)) return 0;
    }
  }
  return 1;
}
int main() {
  t = read();
  while (t--) {
    st.clear();
    solved = 0;
    n = read();
    m = read();
    k = read();
    for (int i = 1; i <= n; ++i)
      has[i].clear(), E[i].clear(), del[i] = d[i] = 0;
    for (int i = 0; i < m; ++i) {
      int u, v;
      u = read();
      v = read();
      E[u].push_back(v);
      E[v].push_back(u);
      d[u]++;
      d[v]++;
      has[u].insert(v);
      has[v].insert(u);
    }
    if (k > 500) {
      puts("-1");
      continue;
    }
    for (int i = 1; i <= n; ++i) st.insert({d[i], i});
    while (!st.empty()) {
      auto pii = *(st.begin());
      int deg = pii.first, u = pii.second;
      if (deg >= k) {
        printf("1 %d\n", st.size());
        for (auto& v : st) printf("%d ", v.second);
        puts("");
        solved = 1;
        break;
      } else if (deg < k - 1) {
        st.erase(st.begin());
        del[u] = 1;
        for (auto& v : E[u]) {
          if (!del[v]) {
            st.erase({d[v], v});
            st.insert({--d[v], v});
          }
        }
      } else {
        st.erase(st.begin());
        del[u] = 1;
        chk.clear();
        chk.push_back(u);
        for (auto& v : E[u]) {
          if (!del[v]) {
            chk.push_back(v);
            st.erase({d[v], v});
            st.insert({--d[v], v});
          }
        }
        if (check()) {
          puts("2");
          for (auto& v : chk) printf("%d ", v);
          puts("");
          solved = 1;
          break;
        }
        for (auto& v : E[u]) {
          if (!del[v]) {
            has[u].erase(v);
          }
        }
      }
    }
    if (!solved) puts("-1");
  }
}
