#include <bits/stdc++.h>
using namespace std;
long long denom = 998244353;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= denom;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % denom;
    a = a * a % denom;
  }
  return res;
}
int main(int argc, const char* argv[]) {
  ios_base::sync_with_stdio(false);
  long long t;
  cin >> t;
  while (t-- > 0) {
    long long n, m, k;
    cin >> n >> m >> k;
    vector<unordered_set<long long>> v(n);
    for (long long i = (0); i < (m); i++) {
      long long u1, u2;
      cin >> u1 >> u2;
      u1--;
      u2--;
      v[u1].insert(u2);
      v[u2].insert(u1);
    }
    vector<long long> state(n, 1);
    queue<long long> q;
    for (long long i = (0); i < (n); i++) {
      if (v[i].size() < k - 1) {
        q.push(i);
        state[i] = 0;
      }
    }
    while (q.size() > 0) {
      long long t = q.front();
      q.pop();
      for (auto a : v[t]) {
        if (state[a] == 0) continue;
        v[a].erase(t);
        if (v[a].size() < k - 1) {
          q.push(a);
          state[a] = 0;
        }
      }
      v[t].clear();
    }
    vector<long long> click;
    for (long long i = (0); i < (n); i++) {
      if (state[i] == 0) continue;
      if (v[i].size() == k - 1) click.push_back(i);
    }
    long long j = 0;
    vector<long long> finalClick;
    while (j < click.size()) {
      long long a = click[j++];
      if (v[a].size() == k - 1) {
        vector<long long> possibleClick = {a};
        for (long long b : v[a]) {
          bool ok = true;
          for (long long i = 1; i < possibleClick.size(); i++) {
            if (v[b].find(possibleClick[i]) == v[b].end()) {
              ok = false;
              break;
            }
          }
          if (!ok) break;
          possibleClick.push_back(b);
        }
        if (possibleClick.size() == k) {
          finalClick = possibleClick;
          break;
        }
      }
      for (long long b : v[a]) {
        v[b].erase(a);
        if (v[b].size() == k - 1) click.push_back(b);
      }
      v[a].clear();
    }
    if (finalClick.size() == k) {
      cout << 2 << endl;
      for (auto a : finalClick) cout << a + 1 << " ";
      cout << endl;
    } else {
      vector<long long> another;
      for (long long i = (0); i < (n); i++) {
        if (v[i].size() >= k) {
          another.push_back(i);
        }
      }
      if (another.size() < k) {
        cout << -1 << endl;
        continue;
      }
      cout << 1 << " " << another.size() << endl;
      for (auto a : another) cout << a + 1 << " ";
      cout << endl;
    }
  }
  return 0;
}
