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;
const long long MOD = 1000000000, inv2 = (MOD + 1) / 2;
long double eps = 1e-6;
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
long double pi = acos(-1.0L);
struct node {
  int x, y, op, id;
  double z;
} a[1000000 + 10], c[1000000 + 10];
bool cmp(node a, node b) { return a.z < b.z; }
int f[1000000 + 10], used[1000000 + 10], n, m, k;
int read() {
  int v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '--') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
long long readll() {
  long long v = 0, f = 1;
  char c = getchar();
  while (c < 48 || 57 < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (48 <= c && c <= 57) v = (v << 3) + v + v + c - 48, c = getchar();
  return v * f;
}
int dsu(int k) {
  if (f[k] != k) f[k] = dsu(f[k]);
  return f[k];
}
int calc(double mid) {
  for (int i = (int)1; i <= (int)m; i++) {
    c[i] = a[i];
    if (c[i].op) c[i].z += mid;
  }
  sort(c + 1, c + m + 1, cmp);
  for (int i = (int)1; i <= (int)m; i++) used[i] = 0;
  for (int i = (int)1; i <= (int)n; i++) f[i] = i;
  int s = 0;
  for (int i = (int)1; i <= (int)m; i++) {
    int x = dsu(c[i].x), y = dsu(c[i].y);
    if (x != y) {
      f[x] = y;
      used[c[i].id] = 1;
      s += c[i].op;
    }
  }
  return s;
}
void solve() {
  double l = -1e6, r = 1e6;
  int t;
  for (int i = (int)1; i <= (int)100; i++) {
    double mid = (l + r) / 2;
    t = calc(mid);
    if (t == k)
      break;
    else if (t < k)
      r = mid;
    else
      l = mid;
  }
  if (t != k) {
    printf("-1\n");
    return;
  }
  int res = 0;
  for (int i = (int)1; i <= (int)m; i++)
    if (used[i]) res++;
  printf("%d\n", res);
  for (int i = (int)1; i <= (int)m; i++)
    if (used[i]) printf("%d ", i);
}
int main() {
  n = read(), m = read(), k = read();
  for (int i = (int)1; i <= (int)m; i++) {
    a[i].x = read(), a[i].y = read();
    scanf("%lf", &a[i].z);
    if (a[i].x == 1 || a[i].y == 1) a[i].op = 1;
    a[i].id = i;
  }
  solve();
  return 0;
}