#include <bits/stdc++.h>
using namespace std;
unordered_set<int> valid;
void drop(vector<unordered_set<int>> &g, int u) {
  for (int v : g[u]) {
    g[v].erase(u);
  }
  g[u].clear();
  valid.erase(u);
}
bool check(vector<unordered_set<int>> &g, int u) {
  unordered_set<int> c = g[u];
  for (int v : c) {
    for (int w : c) {
      if (w != v && g[v].find(w) == g[v].end()) {
        return false;
      }
    }
  }
  return true;
}
int solve() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  vector<unordered_set<int>> g(n);
  valid.clear();
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a, --b;
    g[a].insert(b);
    g[b].insert(a);
  }
  vector<pair<int, int>> v;
  for (int i = 0; i < n; ++i) {
    valid.insert(i);
  }
  while (1) {
    if (valid.size() < k) {
      printf("-1\n");
      return 0;
    }
    v.clear();
    for (int i : valid) {
      v.push_back({g[i].size(), i});
    }
    sort(v.begin(), v.end());
    if (v[0].first >= k) {
      printf("1 %d\n", valid.size());
      for (int w : valid) {
        printf("%d ", w + 1);
      }
      printf("\n");
      return 0;
    }
    for (auto p : v) {
      int u = p.second;
      if (g[u].size() < k - 1) {
        drop(g, u);
      }
      if (g[u].size() == k - 1) {
        if (check(g, u)) {
          printf("2\n");
          printf("%d ", u + 1);
          for (int w : g[u]) {
            printf("%d ", w + 1);
          }
          printf("\n");
          return 0;
        } else {
          drop(g, u);
        }
      }
      if (g[u].size() >= k) {
        break;
      }
    }
  }
}
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; ++i) {
    solve();
  }
  return 0;
}
