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 int maxn = 1e5 + 10;
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 3) + (x << 1) + c - 48;
    c = getchar();
  }
  return x * f;
}
struct node {
  int x, y, z, id;
} b[maxn], w[maxn];
int tot1 = 0, tot2 = 0;
int k, m, n;
int cmp(node x, node y) { return x.z < y.z; }
int fa[maxn];
int find(int x) {
  if (x == fa[x]) return x;
  return fa[x] = find(fa[x]);
}
int check(int sum) {
  int l1 = 1, l2 = 1, num = 1, numm = 0, ans = 0;
  for (register int i = 1; i <= n; i++) fa[i] = i;
  while (num < n) {
    if (l1 > tot1 && l2 > tot2) return -100010;
    if (l1 > tot1 + 10) return -100010;
    if (((b[l1].z < w[l2].z + sum && l1 <= tot1) || l2 > tot2 || numm >= k)) {
      int x = b[l1].x, y = b[l1].y;
      if (find(x) != find(y)) {
        num++;
        fa[find(x)] = find(y);
        ans += b[l1].z;
      }
      l1++;
    } else if (l2 <= tot2) {
      if (numm >= k) {
        l2++;
        continue;
      }
      int x = w[l2].x, y = w[l2].y;
      if (find(x) != find(y)) {
        num++;
        numm++;
        fa[find(x)] = find(y);
        ans += w[l2].z + sum;
      }
      l2++;
    }
  }
  if (num < n) {
    puts("-1");
    exit(0);
  }
  if (numm >= k) return ans - k * sum;
  return -100010;
}
inline void solve(int sum) {
  int l1 = 1, l2 = 1, num = 1, numm = 0, ans = 0;
  for (register int i = 1; i <= n; i++) fa[i] = i;
  while (num < n) {
    if (l1 <= tot1 && (((b[l1].z < w[l2].z + sum) || l2 > tot2 || numm >= k))) {
      int x = b[l1].x, y = b[l1].y;
      if (find(x) != find(y)) {
        printf("%d ", b[l1].id);
        num++;
        fa[find(x)] = find(y);
        ans += b[l1].z;
      }
      l1++;
    } else {
      int x = w[l2].x, y = w[l2].y;
      if (find(x) != find(y)) {
        printf("%d ", w[l2].id);
        num++;
        numm++;
        fa[find(x)] = find(y);
        ans += w[l2].z + sum;
      }
      l2++;
    }
  }
  return;
}
int main() {
  n = read();
  m = read();
  k = read();
  int tot = 0;
  for (register int i = 1; i <= m; i++) {
    int x = read(), y = read(), z = read(), c = 1;
    if (x == 1 || y == 1) {
      c = 0;
      tot++;
    }
    if (c == 1)
      b[++tot1] = (node){x, y, z, i};
    else
      w[++tot2] = (node){x, y, z, i};
  }
  if (tot < k) {
    puts("-1");
    return 0;
  }
  sort(b + 1, b + tot1 + 1, cmp);
  sort(w + 1, w + tot2 + 1, cmp);
  int l = -100005, r = 100005, anss = -100010;
  while (l <= r) {
    int mid = (l + r) >> 1, ans;
    ans = check(mid);
    if (ans != -100010) {
      l = mid + 1;
      anss = mid;
    } else
      r = mid - 1;
  }
  if (anss == -100010) {
    puts("-1");
    return 0;
  }
  printf("%d\n", n - 1);
  solve(anss);
  return 0;
}