#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
const int INF = 1000000009;
const ll MOD = 1000000007LL;
int t;
int n, m, k;
unordered_set<int> s[100009];
bool vis[100009];
inline bool Check(int x) {
  bool ok = 1;
  for (auto i : s[x]) {
    for (auto j : s[x]) {
      if (i == j) continue;
      if (s[i].count(j) == 0) {
        ok = 0;
        break;
      }
    }
    if (!ok) break;
  }
  return ok;
}
int main() {
  ios::sync_with_stdio();
  cin.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> m >> k;
    for (int i = 1; i <= n; ++i) s[i].clear();
    fill(vis, vis + n + 1, 0);
    for (int i = 1; i <= m; ++i) {
      int a, b;
      cin >> a >> b;
      s[a].insert(b);
      s[b].insert(a);
    }
    if (sqrt(2 * m) + 1 < k) {
      cout << -1 << '\n';
      continue;
    }
    priority_queue<pii, vector<pii>, greater<pii>> pq;
    for (int i = 1; i <= n; ++i) pq.push(make_pair((int)(s[i]).size(), i));
    while ((int)(pq).size() && pq.top().first < k - 1) {
      pii p = pq.top();
      pq.pop();
      if (vis[p.second] == 1) continue;
      vis[p.second] = 1;
      for (auto i : s[p.second])
        if (vis[i] == 0) {
          s[i].erase(p.second);
          pq.push(make_pair((int)(s[i]).size(), i));
        }
    }
    bool ok = 0;
    while ((int)(pq).size() && pq.top().first <= k - 1) {
      pii p = pq.top();
      pq.pop();
      if (vis[p.second] == 1) continue;
      vis[p.second] = 1;
      if ((int)(s[p.second]).size() == k - 1 && Check(p.second)) {
        ok = 1;
        cout << 2 << '\n' << p.second << " ";
        for (auto i : s[p.second]) cout << i << " ";
        cout << '\n';
        break;
      }
      for (auto i : s[p.second])
        if (vis[i] == 0) {
          s[i].erase(p.second);
          pq.push(make_pair((int)(s[i]).size(), i));
        }
    }
    if (ok) continue;
    while ((int)(pq).size() && pq.top().first < k) {
      pii p = pq.top();
      pq.pop();
      if (vis[p.second] == 1) continue;
      vis[p.second] = 1;
      for (auto i : s[p.second])
        if (vis[i] == 0) {
          s[i].erase(p.second);
          pq.push(make_pair((int)(s[i]).size(), i));
        }
    }
    set<int> ans;
    while ((int)(pq).size()) {
      pii p = pq.top();
      pq.pop();
      if (vis[p.second] == 1) continue;
      ans.insert(p.second);
    }
    if ((int)(ans).size() == 0) {
      cout << -1 << '\n';
      continue;
    }
    cout << 1 << " " << (int)(ans).size() << '\n';
    for (auto i : ans) cout << i << " ";
    cout << '\n';
  }
}
