#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int mod = 1e9 + 7;
const int p = 1557;
void solve() {
  int n, m, k, u, v;
  cin >> n >> m >> k;
  vector<unordered_set<int>> adj(n + 1);
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    adj[u].insert(v);
    adj[v].insert(u);
  }
  priority_queue<array<int, 2>> pq;
  for (int i = 1; i <= n; i++) {
    pq.push({-(int)adj[i].size(), i});
  }
  while (pq.size()) {
    int node = pq.top()[1], deg = -pq.top()[0];
    pq.pop();
    if (adj[node].size() != deg) continue;
    if (deg >= k) {
      vector<int> store;
      for (int i = 1; i <= n; i++) {
        if (adj[i].size() >= k) {
          store.push_back(i);
        }
      }
      cout << 1 << " " << store.size() << "\n";
      for (int temp : store) {
        cout << temp << " ";
      }
      cout << "\n";
      return;
    }
    vector<int> neigh;
    for (int nxt : adj[node]) {
      neigh.push_back(nxt);
    }
    if (deg < k - 1) {
      for (int nxt : neigh) {
        adj[nxt].erase(node);
        adj[node].erase(nxt);
        pq.push({-(int)adj[nxt].size(), nxt});
      }
    } else {
      int ok = 1;
      for (int i = 0; i < neigh.size(); i++) {
        for (int j = i + 1; j < neigh.size(); j++) {
          if (!adj[neigh[i]].count(neigh[j])) {
            ok = 0;
            break;
          }
        }
        if (!ok) break;
      }
      if (ok) {
        cout << 2 << "\n";
        for (int nxt : neigh) {
          cout << nxt << " ";
        }
        cout << node << " \n";
        return;
      } else {
        for (int nxt : neigh) {
          adj[nxt].erase(node);
          adj[node].erase(nxt);
          pq.push({-(int)adj[nxt].size(), nxt});
        }
      }
    }
  }
  cout << -1 << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  std::cout << std::fixed << std::setprecision(20);
  ;
  int t = 1;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    solve();
  }
}
