#include <bits/stdc++.h>
using namespace std;
const int max_n = 150;
int main() {
  int t, n, m, k, u, v;
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d%d", &n, &m, &k);
    vector<vector<int> > g(n + 1);
    vector<int> du(n + 1);
    for (int i = 0; i < m; ++i) {
      scanf("%d%d", &u, &v);
      g[u].push_back(v);
      g[v].push_back(u);
    }
    if (1ll * k * (k - 1) / 2 > m) {
      cout << -1 << endl;
      continue;
    }
    queue<int> q;
    vector<int> vis(n + 1);
    for (int i = 1; i <= n; ++i) {
      sort(g[i].begin(), g[i].end());
      du[i] = g[i].size();
      if (du[i] < k) {
        vis[i] = 1;
        q.push(i);
      }
    }
    vector<int> ans;
    bool f = 0;
    while (!q.empty()) {
      u = q.front();
      q.pop();
      vis[u] = 2;
      if (du[u] == k - 1 && ans.empty() && k * (k - 1) / 2 <= m) {
        ans.push_back(u);
        for (auto i : g[u]) {
          if (vis[i] < 2) {
            ans.push_back(i);
          }
        }
        f = 1;
        for (auto i : ans) {
          if (!f) {
            break;
          }
          for (auto j : ans) {
            if (i == j) {
              continue;
            }
            if (!binary_search(g[i].begin(), g[i].end(), j)) {
              f = 0;
              break;
            }
          }
        }
        if (!f) {
          ans.clear();
        }
      }
      if (f) {
        break;
      }
      for (auto i : g[u]) {
        if (--du[i] < k && !vis[i]) {
          vis[i] = 1;
          q.push(i);
        }
      }
    }
    if (f) {
      cout << 2 << endl;
      for (auto i : ans) {
        cout << i << " ";
      }
      cout << endl;
      continue;
    }
    int sum = 0;
    for (int i = 1; i <= n; ++i) {
      if (vis[i] == 0) {
        sum++;
      }
    }
    if (sum) {
      cout << 1 << " " << sum << endl;
      for (int i = 1; i <= n; ++i) {
        if (!vis[i]) {
          cout << i << " ";
        }
      }
      cout << endl;
      continue;
    }
    cout << -1 << endl;
  }
  return 0;
}
