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, z, op, id;
} a[1000000 + 10], c[1000000 + 10];
bool cmp(node a, node b) {
  if (a.z != b.z) return a.z < b.z;
  return a.op < b.op;
}
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];
}
pair<int, long long> calc(int 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, num = n;
  long long ans = 0;
  for (int i = (int)1; i <= (int)m; i++) {
    int x = dsu(c[i].x), y = dsu(c[i].y);
    if (x != y && s + c[i].op <= k) {
      f[x] = y;
      ans += c[i].z;
      used[c[i].id] = 1;
      s += c[i].op;
      num--;
    }
  }
  if (num != 1) ans = 2e10;
  return make_pair(s, ans);
}
void solve() {
  pair<int, long long> t = calc(-2e5);
  if (t.second == 2e10 || t.first < k) {
    printf("-1\n");
    return;
  }
  t = calc(2e5);
  if (t.second < 2e10 && t.first > k) {
    printf("-1\n");
    return;
  }
  int l = -1e5, r = 1e5;
  int ans = -1e5;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (calc(mid).first >= k)
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  }
  if (calc(ans).first > k) ans++, calc(ans);
  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(), a[i].z = read();
    if (a[i].x == 1 || a[i].y == 1) a[i].op = 1;
    a[i].id = i;
  }
  solve();
  return 0;
}