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>
long long const N = 50000;
long long const M = 500000;
struct Edge {
  long long u, v;
  long long val;
  long long index;
  Edge(long long u = 0, long long v = 0, long long val = 0, long long i = 0)
      : u(u), v(v), val(val), index(i) {}
};
Edge edges[M + 1];
std::vector<Edge> orig;
std::vector<Edge> spec;
std::vector<Edge> morig;
std::vector<Edge> mspec;
long long father[N + 1];
long long turn;
long long n, m, k;
long long s = 1;
long long porig;
long long pspec;
std::vector<std::pair<Edge, long long> > mark;
bool used[M + 1];
long long get(long long);
bool cmp(const Edge &, const Edge &);
long long compute(long long, long long);
bool cmp(const Edge &a, const Edge &b) { return a.val < b.val; }
long long get(long long x) {
  if (father[x] == x) {
    return x;
  } else {
    father[x] = get(father[x]);
    return father[x];
  }
}
long long compute(long long x, long long k) {
  for (long long i = 1; i <= n; i++) {
    father[i] = i;
  }
  turn = 0;
  long long ans = 0;
  long long cnt = 0;
  porig = 0;
  pspec = 0;
  morig.clear();
  mspec.clear();
  mark.clear();
  for (long long i = 1; i <= m; i++) {
    Edge edge;
    if (porig >= orig.size()) {
      edge = spec[pspec];
      pspec++;
    } else if (pspec >= spec.size()) {
      edge = orig[porig];
      porig++;
    } else {
      if (orig[porig].val < spec[pspec].val + x ||
          (orig[porig].val == spec[pspec].val + x && !k)) {
        edge = orig[porig];
        porig++;
      } else {
        if (orig[porig].val == spec[pspec].val + x) {
          k--;
        }
        edge = spec[pspec];
        pspec++;
      }
    }
    long long u = edge.u;
    long long v = edge.v;
    if (get(u) != get(v)) {
      cnt++;
      ans += edge.val;
      father[get(u)] = get(v);
      if (u == s || v == s) {
        turn++;
        ans += x;
        mspec.push_back(edge);
      } else {
        morig.push_back(edge);
      }
    }
  }
  if (cnt != n - 1) {
    return -1;
  } else {
    return ans;
  }
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  std::cin >> n >> m >> k;
  std::set<long long> cnt;
  for (long long i = 1; i <= m; i++) {
    std::cin >> edges[i].u >> edges[i].v >> edges[i].val;
    edges[i].index = i;
    if (edges[i].u == s) {
      cnt.insert(edges[i].v);
    } else if (edges[i].v == s) {
      cnt.insert(edges[i].u);
    }
  }
  std::sort(edges + 1, edges + 1 + m, cmp);
  for (long long i = 1; i <= m; i++) {
    if (edges[i].u == s || edges[i].v == s) {
      spec.push_back(edges[i]);
    } else {
      orig.push_back(edges[i]);
    }
  }
  if (cnt.size() < k || compute(0, 0) == -1) {
    std::cout << -1;
  } else {
    long long l = -1e5;
    long long r = 1e5;
    long long ans = 0;
    while (l <= r) {
      long long mid = (l + r) >> 1;
      compute(mid, 0);
      if (turn <= k) {
        ans = mid;
        r = mid - 1;
      } else {
        l = mid + 1;
      }
    }
    compute(ans, 0);
    if (turn > k) {
      std::cout << -1;
    } else {
      std::cout << n - 1 << '\n';
      long long need = 0;
      if (turn < k) {
        need = k - turn;
      }
      compute(ans, need);
      for (long long i = 0; i < mspec.size(); i++) {
        std::cout << mspec[i].index << ' ';
      }
      for (long long i = 0; i < morig.size(); i++) {
        std::cout << morig[i].index << ' ';
      }
    }
  }
  return 0;
}