#include <bits/stdc++.h>
using namespace std;
int n, m, k;
unordered_set<int> G[100013];
int deg[100013];
vector<int> r2;
bool ck(int u) {
  for (auto i = G[u].begin(); i != G[u].end(); i++) {
    for (auto j = i; j != G[u].end(); j++) {
      if (i == j) continue;
      if (G[*i].find(*j) == G[*i].end()) return 0;
    }
  }
  r2.clear();
  r2.push_back(u);
  for (auto i : G[u]) {
    r2.push_back(i);
  }
  return 1;
}
priority_queue<pair<int, int>> q;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T, de, u, v;
  cin >> T;
  while (T--) {
    cin >> n >> m >> k;
    while (!q.empty()) q.pop();
    for (int i = 1; i <= n; i++) {
      G[i].clear();
    }
    for (int i = 0; i < m; i++) {
      cin >> u >> v;
      G[u].insert(v);
      G[v].insert(u);
    }
    if ((k - 1ll) * k > 2ll * m) {
      cout << "-1\n";
      continue;
    }
    for (int i = 1; i <= n; i++) {
      deg[i] = (int)G[i].size();
      q.push(make_pair(-deg[i], i));
    }
    int res = -1;
    while (!q.empty()) {
      de = -q.top().first, u = q.top().second;
      if (!deg[u]) {
        q.pop();
        continue;
      }
      if (de >= k) {
        res = 1;
        break;
      }
      if (de == k - 1 && ck(u)) {
        res = 2;
        break;
      }
      q.pop();
      for (auto v : G[u]) {
        G[v].erase(u);
        deg[v]--;
        q.push(make_pair(-deg[v], v));
      }
      G[u].clear(), deg[u] = 0;
    }
    if (res == 1) {
      r2.clear();
      for (int i = 1; i <= n; i++) {
        if (deg[i]) r2.push_back(i);
      }
      int si = (int)r2.size();
      cout << "1 " << si << "\n";
      for (int i = 0; i < si; i++) cout << r2[i] << " ";
      cout << "\n";
    } else if (res == 2) {
      cout << "2\n";
      for (int i = 0; i < k; i++) cout << r2[i] << " ";
      cout << "\n";
    } else
      cout << "-1\n";
  }
  return 0;
}
