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;
template <typename G, typename H>
struct triple {
  G first, second;
  H T;
  triple(G x, G y, H z) : first(x), second(y), T(z) {}
  triple() : first(0), second(0), T(0) {}
};
struct DS {
  vector<int> parent, cont;
  DS(int n) {
    parent = vector<int>(n);
    cont = vector<int>(n, 1);
    for (int i = 0; i < n; i++) parent[i] = i;
  }
  int SetOf(int x) {
    return parent[x] = (parent[x] == x ? x : SetOf(parent[x]));
  }
  bool Merge(int x, int y) {
    x = SetOf(x);
    y = SetOf(y);
    if (x == y) return false;
    if (cont[x] > cont[y]) swap(x, y);
    cont[y] += cont[x];
    parent[x] = y;
    return true;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  int deg = 0;
  map<pair<int, int>, int> mp;
  vector<triple<int, long double> > edges;
  for (int i = 0; i < m; i++) {
    int x, y, w;
    cin >> x >> y >> w;
    --x;
    --y;
    if (x > y) swap(x, y);
    mp[{x, y}] = i + 1;
    edges.push_back({x, y, (long double)w});
    deg += (x == 0);
  }
  if (deg < k) {
    cout << "-1\n";
    return 0;
  }
  vector<int> ed;
  auto val = [&](long double x) {
    for (auto &i : edges)
      if (i.first == 0) i.T += x;
    ed.clear();
    DS ds(n);
    sort(edges.begin(), edges.end(),
         [](triple<int, long double> x, triple<int, long double> y) {
           if (x.T == y.T) return x.first < y.first;
           return x.T < y.T;
         });
    int ret = 0;
    for (int i = 0; i < m; i++) {
      if (ds.SetOf(edges[i].first) != ds.SetOf(edges[i].second) &&
          (ret + (edges[i].first == 0) <= k)) {
        ds.Merge(edges[i].first, edges[i].second);
        ed.push_back(i);
        ret += (edges[i].first == 0);
      }
    }
    for (auto &i : edges)
      if (i.first == 0) i.T -= x;
    return ret;
  };
  long double l = -1e9, r = 1e9;
  for (int i = 0; i < 70; i++) {
    long double mid = (l + r) / 2;
    9999;
    if (val(mid) >= k)
      l = mid;
    else
      r = mid;
  }
  if (val(l) != k || ed.size() != n - 1)
    cout << "-1\n";
  else {
    cout << n - 1 << '\n';
    for (int i = 0; i < n - 1; i++) {
      int x = edges[ed[i]].first;
      int y = edges[ed[i]].second;
      cout << mp[{x, y}] << " \n"[i == n - 2];
    }
  }
  return 0;
}