#include <bits/stdc++.h>
using namespace std;
int i, j, k, l, n, m, x;
unordered_set<int> a[100009];
set<pair<int, int> > q;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int nt;
  cin >> nt;
  while (nt--) {
    cin >> n >> m >> x;
    for (i = 1; i <= n; i++) a[i].clear();
    for (i = 1; i <= m; i++) {
      cin >> k >> l;
      a[k].insert(l);
      a[l].insert(k);
    }
    q.clear();
    for (i = 1; i <= n; i++) {
      q.insert({(int)a[i].size(), i});
    }
    int flag = 0;
    while (q.size() > 0) {
      pair<int, int> p = *q.begin();
      if (p.first >= x) {
        flag = 1;
        cout << 1 << ' ' << q.size() << '\n';
        for (auto to : q) cout << to.second << ' ';
        cout << '\n';
        break;
      }
      if (p.first == x - 1) {
        vector<int> st;
        for (auto to : a[p.second]) st.push_back(to);
        int can = 1;
        for (auto to : st) {
          for (auto to1 : st) {
            if (to != to1 && a[to].count(to1) == 0) {
              can = 0;
              break;
            }
          }
          if (can == 0) break;
        }
        if (can) {
          cout << 2 << '\n';
          for (auto to : st) cout << to << ' ';
          cout << p.second << '\n';
          flag = 1;
          break;
        }
      }
      if (p.first <= x - 1) {
        for (auto to : a[p.second]) {
          a[to].erase(p.second);
          q.erase({(int)a[to].size() + 1, to});
          if (a[to].size() > 0) q.insert({(int)a[to].size(), to});
        }
        q.erase(p);
      }
    }
    if (!flag) cout << -1 << '\n';
  }
  exit(0);
}
