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;
int n, m, K, f[100012];
inline int getf(int x) { return (f[x] == x) ? x : (f[x] = getf(f[x])); }
struct Edge {
  int x, y, v, d;
  bool fl;
} e[100012], e1[100012];
inline bool cmp1(Edge x, Edge y) {
  return (x.v < y.v) || ((x.v == y.v) && (x.fl < y.fl));
}
inline bool cmp2(Edge x, Edge y) {
  return (x.v < y.v) || ((x.v == y.v) && (x.fl > y.fl));
}
inline bool Merge(int x, int y) {
  int t1 = getf(x), t2 = getf(y);
  if (t1 == t2) return false;
  f[t2] = t1;
  return true;
}
inline int calc(int mid, bool cmp(Edge x, Edge y)) {
  int i, res = 0, c1 = 0;
  for (i = 1; i <= m; i++) e1[i] = e[i], e1[i].v += e1[i].fl * (mid - 1e5);
  sort(e1 + 1, e1 + m + 1, cmp);
  for (i = 1; i <= n; i++) f[i] = i;
  for (i = 1; i <= m; i++)
    if (Merge(e1[i].x, e1[i].y)) res += e1[i].fl, ++c1;
  return (c1 == (n - 1)) ? res : (-1);
}
int slo = -1, L[100012], R[100012], cn = 0, a[100012], s[100012], now;
bool b[100012];
int main() {
  scanf("%d%d%d", &n, &m, &K);
  int i, k, x, y, v, l = 0, r = 3e5, mid, rem;
  for (i = 1; i <= m; i++) {
    scanf("%d%d%d", &x, &y, &v);
    e[i] = (Edge){x, y, v, i, (x == 1) || (y == 1)};
  }
  while (l <= r) {
    mid = (l + r) >> 1;
    if (calc(mid, cmp2) >= K) {
      slo = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  if (slo == (-1)) {
    printf("-1");
    return 0;
  }
  if (calc(slo, cmp1) > K) {
    printf("-1");
    return 0;
  }
  for (i = 1; i <= m; i++) e[i].v += e[i].fl * (slo - 1e5);
  sort(e + 1, e + m + 1, cmp2);
  for (i = 1; i <= n; i++) f[i] = i;
  for (i = 1; i <= m; i = r + 1) {
    l = r = i;
    while ((r < m) && (e[r + 1].v == e[r].v)) ++r;
    L[++cn] = l;
    R[cn] = r;
    for (i = l; i <= r; i++) a[cn] += Merge(e[i].x, e[i].y) && e[i].fl;
  }
  for (i = cn; i >= 1; i--) s[i] = s[i + 1] + a[i];
  now = 0;
  for (i = 1; i <= n; i++) f[i] = i;
  for (k = 1; k <= cn; k++) {
    l = L[k];
    r = R[k];
    rem = max(K - now - s[k + 1], 0);
    for (i = l; e[i].fl && (i <= r); i++)
      if (getf(e[i].x) != getf(e[i].y)) {
        if (!rem) break;
        Merge(e[i].x, e[i].y);
        b[e[i].d] = 1;
        ++now;
        --rem;
      }
    sort(e + l, e + r + 1, cmp1);
    for (i = l; i <= r; i++)
      if ((!b[e[i].d]) && (getf(e[i].x) != getf(e[i].y))) {
        Merge(e[i].x, e[i].y);
        b[e[i].d] = 1;
        now += e[i].fl;
      }
  }
  printf("%d\n", n - 1);
  for (i = 1; i <= m; i++)
    if (b[i]) printf("%d ", i);
  return 0;
}