#include <bits/stdc++.h>
using namespace std;
vector<int> edges[200005];
int deg[200005];
bool vis[200005], excl[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, i, j, u, v, w, k, t;
  cin >> t;
  while (t--) {
    cin >> n >> m >> k;
    for (i = 1; i <= n; i++) {
      deg[i] = 0;
      edges[i].clear();
      vis[i] = false;
      excl[i] = false;
    }
    for (i = 1; i <= m; i++) {
      cin >> u >> v;
      edges[u].push_back(v);
      edges[v].push_back(u);
      deg[u]++;
      deg[v]++;
    }
    for (i = 1; i <= n; i++) sort(edges[i].begin(), edges[i].end());
    priority_queue<pair<int, int>, vector<pair<int, int> >,
                   greater<pair<int, int> > >
        pq;
    for (i = 1; i <= n; i++) pq.push({deg[i], i});
    vector<int> ans;
    bool clique = false;
    while (!pq.empty()) {
      j = pq.top().first;
      u = pq.top().second;
      pq.pop();
      if (vis[u]) continue;
      vis[u] = true;
      if (j >= k) {
        ans.push_back(u);
        continue;
      } else if (j == (k - 1) && ((k - 1) * k / 2 <= m)) {
        int sz = edges[u].size();
        bool ase = true;
        for (i = 0; i < sz; i++) {
          v = edges[u][i];
          if (excl[v]) continue;
          for (j = i + 1; j < sz; j++) {
            w = edges[u][j];
            if (excl[w]) continue;
            ase = binary_search(edges[v].begin(), edges[v].end(), w);
            if (!ase) break;
          }
          if (!ase) break;
        }
        if (ase) {
          clique = true;
          break;
        }
      }
      excl[u] = true;
      for (int v : edges[u]) {
        deg[v]--;
        pq.push({deg[v], v});
      }
    }
    if (clique) {
      cout << 2 << endl << u << ' ';
      for (int v : edges[u]) {
        if (!excl[v]) cout << v << ' ';
      }
      cout << endl;
    } else if (ans.size() > k) {
      cout << 1 << ' ' << ans.size() << endl;
      for (int x : ans) cout << x << ' ';
      cout << endl;
    } else {
      cout << -1 << endl;
    }
  }
}
