#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
unordered_set<int> x[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int times;
  cin >> times;
  while (times--) {
    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 1; i <= n; ++i) {
      x[i].clear();
    }
    for (int i = 0; i < m; ++i) {
      int a, b;
      cin >> a >> b;
      x[a].insert(b);
      x[b].insert(a);
    }
    queue<int> q;
    for (int i = 1; i <= n; ++i) {
      if (x[i].size() >= k - 1) continue;
      q.push(i);
    }
    while (!q.empty()) {
      int a = q.front();
      q.pop();
      for (int b : x[a]) {
        x[b].erase(a);
        if (x[b].size() >= k - 1) continue;
        q.push(b);
      }
      x[a].clear();
    }
    auto check_clique = [&](int a) -> bool {
      if (x[a].size() != k - 1) return false;
      unordered_set<int> s = x[a];
      s.insert(a);
      for (int b : x[a]) {
        int cnt = 0;
        for (int c : s) {
          if (x[b].find(c) != x[b].end()) ++cnt;
        }
        if (cnt != k - 1) return false;
      }
      return true;
    };
    for (int i = 1; i <= n; ++i) {
      if (x[i].size() == k - 1) q.push(i);
    }
    vector<int> clique;
    while (!q.empty()) {
      int a = q.front();
      q.pop();
      if (check_clique(a)) {
        clique.push_back(a);
        for (int b : x[a]) clique.push_back(b);
        break;
      } else {
        for (int b : x[a]) {
          x[b].erase(a);
          if (x[b].size() > k - 1) continue;
          q.push(b);
        }
        x[a].clear();
      }
    }
    if (clique.size() > 0) {
      cout << 2 << endl;
      for (int a : clique) cout << a << " ";
      cout << endl;
      continue;
    }
    vector<int> ans;
    for (int i = 1; i <= n; ++i) {
      if (x[i].size() > 0) ans.push_back(i);
    }
    if (ans.size() > 0) {
      cout << "1 " << ans.size() << endl;
      for (int a : ans) cout << a << " ";
      cout << endl;
    } else {
      cout << -1 << endl;
    }
  }
  return 0;
}
