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;
using ll = long long;
constexpr int maxn = 1e6 + 7;
constexpr int inf = 2e8;
int n, m, S, len, fa[maxn];
ll ans;
vector<pair<pair<int, int>, pair<int, int> > > edge1, edge2, edge3;
int seek(int x) { return x == fa[x] ? x : (fa[x] = seek(fa[x])); }
vector<int> V;
int check(int has, int tag = 0) {
  int i = 0, j = 0, k = 0, cnt = 0;
  while (i < edge1.size() && j < edge2.size()) {
    if (edge1[i].first.first < edge2[j].first.first + has) {
      edge3[k++] = edge1[i++];
    } else
      edge3[k++] = edge2[j++];
  }
  while (i < edge1.size()) edge3[k++] = edge1[i++];
  while (j < edge2.size()) edge3[k++] = edge2[j++];
  for (int i = 1; i <= n; ++i) {
    fa[i] = i;
  }
  V.clear();
  ans = 0;
  int sum = 0;
  bool pre = false;
  for (auto [op, edge] : edge3) {
    auto [w, id] = op;
    auto [u, v] = edge;
    if (seek(u) != seek(v)) {
      if (sum == len && (u == S || v == S)) continue;
      sum += (u == S || v == S);
      ans += w;
      V.push_back(id);
      ++cnt;
      fa[seek(u)] = seek(v);
    }
  }
  return sum;
}
void solve() {
  scanf("%d %d %d", &n, &m, &len);
  edge3.resize(m);
  S = 1;
  int o = 0;
  while (m--) {
    ++o;
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    if (u == S || v == S)
      edge2.push_back({{w, o}, {u, v}});
    else {
      edge1.push_back({{w, o}, {u, v}});
    }
  }
  sort(edge1.begin(), edge1.end());
  sort(edge2.begin(), edge2.end());
  int l = -1e6, r = 1e6, ret = -1e9;
  while (l <= r) {
    int mid = l + r >> 1;
    if (check(mid) >= len) {
      ret = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  check(ret, 1);
  if (ret == -1e9 || (int)V.size() != n - 1) {
    puts("-1");
  } else {
    printf("%d\n", n - 1);
    for (auto v : V) printf("%d ", v);
    puts("");
  }
}
int main() {
  solve();
  return 0;
}