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;
struct edge {
  int u, v, ind;
  double t, w;
  edge() {}
  edge(int u, int v, double w, int ind, double t)
      : u(u), v(v), ind(ind), t(t), w(w) {}
  bool operator<(edge a) const {
    if (w < a.w) return true;
    if (w > a.w) return false;
    if (t) return true;
    return false;
  }
};
const int MAXN = 1000 * 100 + 10;
edge ed[MAXN * 10];
vector<int> ans;
int par[MAXN];
int n, m, k;
bool connect = false;
int get_par(int v) { return par[v] = (v == par[v]) ? v : get_par(par[v]); }
bool merge(int u, int v) {
  u = get_par(u), v = get_par(v);
  if (u == v) return false;
  par[u] = v;
  return true;
}
bool ok(double x) {
  ans.clear();
  for (int i = 0; i < m; i++) ed[i].w += ed[i].t * x;
  for (int i = 0; i < n; i++) par[i] = i;
  sort(ed, ed + m);
  int num = 0;
  for (int i = 0; i < m; i++) {
    int j = i;
    while (i + 1 < m && ed[i].w == ed[i + 1].w) i++;
    for (int p = j; p <= i; p++)
      if (num >= k && ed[p].t)
        continue;
      else if (merge(ed[p].u, ed[p].v)) {
        ans.push_back(ed[p].ind);
        if (ed[p].t) num++;
      }
  }
  if ((int)ans.size() == n - 1) connect = true;
  for (int i = 0; i < m; i++) ed[i].w -= ed[i].t * x;
  if (num >= k) return true;
  return false;
}
double bs(double s, double e) {
  if (e - s <= 1e-3) return s;
  double mid = (s + e) / 2;
  if (!ok(mid))
    return bs(s, mid);
  else
    return bs(mid, e);
}
int main() {
  cin >> n >> m >> k;
  int deg = 0;
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    ed[i] = edge(a, b, c, i, (a == 0 || b == 0) ? 1 : 0);
    if (a == 0 || b == 0) deg++;
  }
  if ((k == 0 && n > 1) || deg < k) {
    cout << -1 << endl;
    return 0;
  }
  double tt = bs(-100 * 1000 - 10, 100 * 1000 + 10);
  ok(tt);
  if (!connect) {
    cout << -1 << endl;
    return 0;
  }
  cout << n - 1 << endl;
  for (int i = 0; i < n - 1; i++) cout << ans[i] + 1 << " ";
  cout << endl;
}