#include <bits/stdc++.h>
using namespace std;
const int MX = 1e5 + 10;
unordered_set<int> adj[MX];
vector<int> ans;
bool vis[MX];
set<pair<int, int>> ord;
void dfs(int u) {
  vis[u] = true;
  ans.push_back(u);
  for (int v : adj[u]) {
    if (!vis[v]) dfs(v);
  }
}
bool can(int k, int t, int n) {
  k -= t;
  for (int i = 1; i <= n; i++) vis[i] = false;
  while (!ord.empty()) {
    auto it = ord.begin();
    if ((*it).first >= k) break;
    int u = (*it).second;
    ord.erase(it);
    for (int v : adj[u]) {
      ord.erase({adj[v].size(), v});
      adj[v].erase(u);
      if (adj[v].size() != 0) ord.insert({adj[v].size(), v});
    }
    adj[u].clear();
  }
  if (t == 0) {
    for (int i = 1; i <= n; i++) {
      if (!vis[i]) {
        ans.clear();
        dfs(i);
        if (ans.size() > k) {
          cout << 1 << " " << ans.size() << "\n";
          for (int xx : ans) cout << xx << " ";
          cout << "\n";
          return true;
        }
      }
    }
    return false;
  }
  while (!ord.empty()) {
    auto it = ord.begin();
    if ((*it).first > k) break;
    int u = (*it).second;
    if ((*it).first == k) {
      vector<int> vv;
      vv.push_back(u);
      for (int v : adj[u]) vv.push_back(v);
      bool ok = true;
      for (int i = 0; i <= k; i++) {
        for (int j = i + 1; j <= k; j++) {
          if (adj[vv[i]].find(vv[j]) == adj[vv[i]].end()) {
            ok = false;
            break;
          }
        }
        if (!ok) break;
      }
      if (ok) {
        cout << 2 << "\n";
        for (int xx : vv) cout << xx << " ";
        cout << "\n";
        return true;
      }
    }
    ord.erase(it);
    for (int v : adj[u]) {
      ord.erase({adj[v].size(), v});
      adj[v].erase(u);
      if (adj[v].size() != 0) ord.insert({adj[v].size(), v});
    }
    adj[u].clear();
  }
  return false;
}
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  ord.clear();
  ans.clear();
  for (int i = 1; i <= n; i++) {
    adj[i].clear();
    vis[i] = false;
  }
  int x, y;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    adj[x].insert(y);
    adj[y].insert(x);
  }
  for (int i = 1; i <= n; i++) ord.insert({adj[i].size(), i});
  if (can(k, 1, n)) return;
  if (can(k, 0, n)) return;
  cout << -1 << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(10);
  cout << fixed;
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
