#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int N = 1e6 + 10;
const long long mod = 1e9 + 7;
const long long mod2 = 998244353;
const long long inf = 8e18;
const int LOG = 22;
long long pw(long long a, long long b, long long M) {
  return (!b ? 1
             : (b & 1 ? (a * pw(a * a % M, b / 2, M)) % M
                      : pw(a * a % M, b / 2, M)));
}
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<unordered_set<int> > G(n + 1);
  vector<int> mark(n + 1, 0);
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    G[a].insert(b);
    G[b].insert(a);
  }
  set<pair<int, int> > st;
  for (int i = 1; i <= n; i++) {
    st.insert(make_pair((int)G[i].size(), i));
  }
  while (!st.empty()) {
    pair<int, int> cu = *st.begin();
    int v = cu.second;
    mark[v] = 1;
    st.erase(st.begin());
    if (cu.first >= k) {
      cout << 1 << " " << 1 + (int)st.size() << "\n";
      cout << v << " ";
      for (auto x : st) {
        cout << x.second << " ";
      }
      cout << "\n";
      return;
    }
    if (cu.first == k - 1) {
      vector<int> cl;
      cl.push_back(v);
      for (auto u : G[v]) {
        cl.push_back(u);
      }
      int is_ok = 1;
      for (int i = 1; i < k; i++) {
        for (int j = i + 1; j < k; j++) {
          if (G[cl[i]].count(cl[j]) == 0) {
            is_ok = 0;
            i = k + 1, j = k + 1;
          }
        }
      }
      if (is_ok) {
        cout << 2 << "\n";
        for (auto x : cl) {
          cout << x << " ";
        }
        cout << "\n";
        return;
      }
    }
    for (auto u : G[v]) {
      st.erase(make_pair((int)G[u].size(), u));
      G[u].erase(v);
      st.insert(make_pair((int)G[u].size(), u));
    }
  }
  cout << -1 << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int q;
  cin >> q;
  while (q--) {
    solve();
  }
  return 0;
}
