#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int vis[N];
int cnt[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m, k;
    memset(vis, 0, sizeof(vis));
    cin >> n >> m >> k;
    vector<vector<int> > ed(n + 1);
    for (int i = 0; i < m; i++) {
      int x, y;
      cin >> x >> y;
      ed[x].push_back(y);
      ed[y].push_back(x);
    }
    queue<int> q;
    for (int i = 1; i <= n; i++) {
      sort(ed[i].begin(), ed[i].end());
      cnt[i] = ed[i].size();
      if (cnt[i] < k) vis[i] = 1, q.push(i);
    }
    vector<int> ans;
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      vis[x] = 2;
      if (cnt[x] == k - 1 && ans.size() == 0 && k * (k - 1) / 2 <= m) {
        ans.push_back(x);
        for (auto y : ed[x])
          if (vis[y] < 2) ans.push_back(y);
        bool flag = 1;
        for (auto i : ans)
          for (auto j : ans)
            if (i != j && !binary_search(ed[i].begin(), ed[i].end(), j))
              flag = 0;
        if (!flag) ans.clear();
      }
      for (int i = 0; i < ed[x].size(); i++) {
        int y = ed[x][i];
        if (--cnt[y] < k && !vis[y]) vis[y] = 1, q.push(y);
      }
    }
    int cn = 0;
    for (int i = 1; i <= n; i++)
      if (!vis[i]) cn++;
    if (cn > 0) {
      cout << 1 << " " << cn << endl;
      bool f = 0;
      for (int i = 1; i <= n; i++) {
        if (!vis[i]) {
          if (f) cout << " ";
          f = 1;
          cout << i;
        }
      }
      cout << endl;
    } else if (ans.size()) {
      cout << 2 << endl;
      for (int i = 0; i < ans.size(); i++) {
        if (i != 0) cout << " ";
        cout << ans[i];
      }
      cout << endl;
    } else
      cout << -1 << endl;
  }
}
