Problem: The MST (Meaningless State Team) company won another tender for an important state reform in Berland.

There are n cities in Berland, some pairs of the cities are connected by roads. Each road has its price. One can move along any road in any direction. The MST team should carry out the repair works on some set of roads such that one can get from any city to any other one moving only along the repaired roads. Moreover, this set should contain exactly k capital roads (that is, the roads that start or finish in the capital). The number of the capital is 1.

As the budget has already been approved, the MST Company will profit by finding the set with minimum lengths of roads.

Input

The first input line contains three integers n, m, k (1 ≤ n ≤ 5000;0 ≤ m ≤ 105;0 ≤ k < 5000), where n is the number of cities in the country, m is the number of roads in the country, k is the number of capital roads in the required set. Then m lines enumerate the roads in question. Each road is specified by three numbers ai, bi, wi (1 ≤ ai, bi ≤ n; 1 ≤ w ≤ 105), where ai, bi are the numbers of cities linked by a road and wi is its length. 

Between each pair of cities no more than one road exists. There are no roads that start and finish in one city. The capital's number is 1.

Output

In the first line print the number of roads in the required set. The second line should contain the numbers of roads included in the sought set. If the sought set does not exist, print -1.

Examples

Input

4 5 2
1 2 1
2 3 1
3 4 1
1 3 3
1 4 2


Output

3
1 5 2 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
bool print;
struct DisjointSet {
  vector<int> lab, Rank;
  DisjointSet() {}
  DisjointSet(int n) {
    lab.assign(n + 5, -1);
    Rank.assign(n + 5, 0);
  }
  int root(int u) { return (lab[u] == -1) ? u : lab[u] = root(lab[u]); }
  void merge(int u, int v) {
    int a = root(u), b = root(v);
    if (a == b) return;
    if (Rank[a] > Rank[b]) swap(a, b);
    lab[a] = b;
    Rank[b] += (Rank[a] == Rank[b]);
  }
};
const double EPS = 1e-7;
struct Edge {
  int u, v, id;
  double w;
  Edge() {}
  Edge(int u, int v, double w, int id) : u(u), v(v), w(w), id(id) {}
  bool operator<(const Edge rhs) const { return w < rhs.w; }
};
const int N = 5e3 + 5, W = 1e5 + 5;
int n, m, k;
Edge dd[W];
bool in_res[W];
vector<Edge> EdgeList, E1, E2;
void input() {
  scanf("%d %d %d", &n, &m, &k);
  for (int nhi = (1), _b = (m); nhi <= _b; nhi++) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    dd[nhi] = Edge(u, v, w, nhi);
    if (u == 1 || v == 1)
      E1.push_back(Edge(u, v, w, nhi));
    else
      E2.push_back(Edge(u, v, w, nhi));
  }
}
int check(double mid) {
  EdgeList.clear();
  memset(in_res, 0, sizeof in_res);
  for (Edge& e : E1) e.w += mid;
  merge(E1.begin(), E1.end(), E2.begin(), E2.end(), back_inserter(EdgeList));
  DisjointSet DSU = DisjointSet(n);
  int ret = 0;
  for (Edge e : EdgeList) {
    if (DSU.root(e.u) != DSU.root(e.v)) {
      DSU.merge(e.u, e.v);
      in_res[e.id] = 1;
      if (e.u == 1 || e.v == 1) {
        ret++;
      }
    }
  }
  for (Edge& e : E1) e.w -= mid;
  return ret;
}
void solve() {
  sort(E1.begin(), E1.end());
  sort(E2.begin(), E2.end());
  for (int i = 0, _n = (E1.size()); i < _n; i++) {
    E1[i].w += EPS * i;
  }
  double l = -W, r = W, increment = -W - 1;
  while (r - l > EPS) {
    double mid = (l + r) / 2;
    int tmp = check(mid);
    if (tmp == k) increment = mid;
    if (tmp > k)
      l = mid;
    else
      r = mid;
  }
  if (abs(increment + W + 1) <= EPS)
    printf("-1\n");
  else {
    check(increment);
    cout << n - 1 << '\n';
    int tmp = 0;
    for (int i = (1), _b = (m); i <= _b; i++)
      if (in_res[i]) {
        cout << i << ' ';
        tmp += dd[i].w;
      }
    cout << '\n';
  }
}
int main(int argc, char const* argv[]) {
  print = 0;
  clock_t tStart = clock();
  input();
  solve();
  fprintf(stderr, "Time taken: %.2fs\n",
          (double)(clock() - tStart) / CLOCKS_PER_SEC);
  return 0;
}