#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T abs(T x) {
  return x < 0 ? -x : x;
}
template <class T>
vector<T> ReadVector(int n) {
  vector<T> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  return a;
}
template <class T>
void WriteVector(const vector<T>& a) {
  for (int i = 0; i < ((int)(a).size()); ++i) {
    cout << a[i] << (i + 1 < ((int)(a).size()) ? ' ' : '\n');
  }
}
void Solve() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<int>> adj(n);
  for (int i = 0; i < m; ++i) {
    int v1, v2;
    cin >> v1 >> v2;
    --v1, --v2;
    adj[v1].push_back(v2);
    adj[v2].push_back(v1);
  }
  if (k == 1) {
    cout << 2 << "\n";
    cout << 1 << "\n";
    return;
  }
  vector<int> deg(n);
  set<pair<int, int>> set_deg;
  for (int i = 0; i < n; ++i) {
    deg[i] = ((int)(adj[i]).size());
    set_deg.insert(make_pair(deg[i], i));
  }
  vector<bool> used(n);
  vector<int> vs;
  while (!set_deg.empty()) {
    auto it = set_deg.begin();
    int cur_deg = it->first;
    int cur_v = it->second;
    if (cur_deg >= k) {
      break;
    }
    vs.push_back(cur_v);
    used[cur_v] = true;
    set_deg.erase(it);
    for (int u : adj[cur_v]) {
      if (!used[u]) {
        set_deg.erase(make_pair(deg[u], u));
        --deg[u];
        set_deg.insert(make_pair(deg[u], u));
      }
    }
  }
  if (!set_deg.empty()) {
    vector<int> res;
    for (auto cur : set_deg) {
      res.push_back(cur.second);
    }
    cout << 1 << " " << ((int)(res).size()) << "\n";
    for (int i = 0; i < ((int)(res).size()); ++i) {
      cout << res[i] + 1 << (i + 1 < ((int)(res).size()) ? ' ' : '\n');
    }
    return;
  }
  if (k * (long long)(k - 1) / 2 > m) {
    cout << -1 << "\n";
    return;
  }
  vector<int> num(n);
  for (int i = 0; i < n; ++i) {
    num[vs[i]] = i;
  }
  vector<vector<int>> next(n);
  for (int i = 0; i < n; ++i) {
    int v = vs[i];
    for (int u : adj[v]) {
      if (num[u] > i) {
        next[i].push_back(num[u]);
      }
    }
    sort((next[i]).begin(), (next[i]).end());
  }
  for (int i = n - 1; i >= 0; --i) {
    if (((int)(next[i]).size()) < k - 1) {
      continue;
    }
    bool key = true;
    for (int j = 0; j < k - 1; ++j) {
      int cur = next[i][j];
      int ind = 0;
      for (int t = j + 1; t < k - 1; ++t) {
        while (ind < ((int)(next[cur]).size()) && next[cur][ind] < next[i][t]) {
          ++ind;
        }
        if (ind == ((int)(next[cur]).size()) || next[cur][ind] != next[i][t]) {
          key = false;
          break;
        }
      }
      if (!key) {
        break;
      }
    }
    if (key) {
      cout << 2 << "\n";
      cout << vs[i] + 1;
      for (int j = 0; j < k - 1; ++j) {
        cout << " " << vs[next[i][j]] + 1;
      }
      cout << "\n";
      return;
    }
  }
  cout << -1 << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  std::cin.tie(nullptr);
  int tc = 1;
  cin >> tc;
  for (int ti = 0; ti < tc; ++ti) {
    Solve();
  }
  return 0;
}
