#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7, inf = 0x3f3f3f3f, mod = 1e9 + 7;
vector<int> g[maxn];
struct node {
  int d, id;
  bool operator<(const node &rhs) const { return d > rhs.d; }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int kase;
  cin >> kase;
  while (kase--) {
    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 1; i <= n; ++i) g[i].clear();
    for (int i = 0, u, v; i < m; ++i) {
      cin >> u >> v;
      g[u].push_back(v);
      g[v].push_back(u);
    }
    vector<int> deg(n + 1), vis(n + 1);
    priority_queue<node> pq;
    for (int i = 1; i <= n; ++i) {
      sort(g[i].begin(), g[i].end());
      deg[i] = g[i].size();
      if (deg[i] < k) pq.push({deg[i], i}), vis[i] = 1;
    }
    bool ok = 0;
    while (!pq.empty()) {
      auto cur = pq.top();
      pq.pop();
      int d = cur.d, u = cur.id;
      vis[u] = -1;
      if (d == k - 1 && k * (k - 1) / 2 <= m) {
        vector<int> clique;
        clique.push_back(u);
        for (auto &v : g[u])
          if (vis[v] != -1) clique.push_back(v);
        if (clique.size() == k) {
          bool is = 1;
          for (auto &i1 : clique) {
            for (auto &i2 : clique) {
              if (i1 == i2) continue;
              if (!binary_search(g[i1].begin(), g[i1].end(), i2)) {
                is = 0;
                break;
              }
            }
            if (!is) break;
          }
          if (is) {
            ok = 1;
            cout << "2\n";
            for (auto &v : clique) cout << v << ' ';
            cout << '\n';
            break;
          }
        }
      }
      for (auto &v : g[u]) {
        if (vis[v] == 0 && --deg[v] < k) {
          pq.push({deg[v], v});
          vis[v] = 1;
        }
      }
    }
    if (!ok) {
      bool can = 0;
      vector<int> ans;
      for (int i = 1; i <= n; ++i)
        if (vis[i] == 0 && deg[i] >= k) can = 1, ans.push_back(i);
      if (can) {
        cout << "1 " << ans.size() << '\n';
        for (auto &v : ans) cout << v << ' ';
        cout << '\n';
      } else
        cout << "-1\n";
    }
  }
  return 0;
}
