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;
int size[5003];
int pred[5003];
void makeset() {
  int i;
  for (i = 0; i < n; i++) {
    pred[i] = i;
    size[i] = 1;
  }
}
int fds(int v) {
  if (pred[v] == v) return v;
  return pred[v] = fds(pred[v]);
}
void uni(int x, int y) {
  if (size[x] > size[y]) {
    size[x] += size[y];
    pred[y] = x;
  } else {
    size[y] += size[x];
    pred[x] = y;
  }
}
struct rebro {
  int x;
  int y;
  int nom;
  long long v;
};
rebro a[100003];
rebro b[100003];
rebro c[100003];
bool flag[100003];
void radixsort(rebro *a, rebro *b) {
  int i, j;
  for (i = 0; i < 4; i++) {
    int d[65537] = {0};
    for (j = 0; j < m; j++) d[((a[j].v >> (16 * i)) & (65535))]++;
    for (j = 1; j < 65536; j++) d[j] += d[j - 1];
    for (j = m - 1; j > -1; j--)
      b[--d[((a[j].v >> (16 * i)) & (65535))]] = a[j];
    for (j = 0; j < m; j++) a[j] = b[j];
  }
  int coun = 0;
  for (i = 0; i < m; i++)
    if (a[i].v < 0) break;
  for (j = i; j < m; j++) b[coun++] = a[j];
  for (j = 0; j <= i; j++) b[coun++] = a[j];
  for (i = 0; i < m; i++) a[i] = b[i];
}
int main() {
  int k;
  scanf("%d %d %d", &n, &m, &k);
  int i;
  for (i = 0; i < m; i++) {
    scanf("%d %d %I64d", &a[i].x, &a[i].y, &a[i].v);
    a[i].x--;
    a[i].y--;
    a[i].v *= (long long)1000000000 * 10000;
    a[i].nom = i + 1;
  }
  long long r = (long long)1000000000 * 1000000000;
  long long l = -r;
  long long re;
  int res;
  int coun;
  bool ok = false;
  int x, y;
  while (r - l > 1) {
    res = 0;
    coun = 0;
    re = ((l + r) >> 1);
    for (i = 0; i < m; i++) {
      flag[i] = false;
      c[i] = a[i];
      if (c[i].x == 0 || c[i].y == 0) c[i].v += re;
    }
    makeset();
    radixsort(c, b);
    for (i = 0; i < m; i++) {
      x = fds(c[i].x);
      y = fds(c[i].y);
      if (x != y) {
        flag[i] = true;
        if (c[i].x == 0 || c[i].y == 0) res++;
        coun++;
        uni(x, y);
      }
    }
    if (res > k) l = re;
    if (res < k) r = re;
    if (res == k) {
      if (coun == n - 1) {
        printf("%d\n", n - 1);
        for (i = 0; i < m; i++)
          if (flag[i]) printf("%d ", c[i].nom);
        printf("\n");
        ok = true;
      }
      break;
    }
  }
  if (!ok) printf("-1\n");
  return 0;
}