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;
struct node {
  int u, v, w, ind;
} a[200010], b[200010];
int fa[200010], ksj, ss, tt, ind[200010], n, m, k, mx;
inline int read() {
  char c = getchar();
  int x = 0, flag = 1;
  while (!isdigit(c)) {
    if (c == '-') flag = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * flag;
}
bool cmp(node a, node b) { return a.w < b.w; }
int find(int x) {
  int y = x;
  while (y != fa[y]) y = fa[y];
  while (x != y) {
    int tmp = fa[x];
    fa[x] = y;
    x = tmp;
  }
  return y;
}
int check(int mid) {
  for (int i = 1; i <= n; i++) fa[i] = i;
  int i = 1, j = 1, cnt = 0, t, x, y;
  while (i <= ss && j <= tt) {
    if (a[i].w + mid <= b[j].w)
      x = find(a[i].u), y = find(a[i].v), i++, t = 1;
    else
      x = find(b[j].u), y = find(b[j].v), j++, t = 0;
    if (x != y) fa[x] = y, cnt += t;
  }
  for (; i <= ss; i++) {
    x = find(a[i].u), y = find(a[i].v);
    if (x != y) fa[x] = y, cnt++;
  }
  return cnt;
}
int main() {
  n = read(), m = read(), k = read(), mx = 0;
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read(), w = read();
    if (u == 1 || v == 1)
      a[++ss] = node{u, v, w, i};
    else
      b[++tt] = node{u, v, w, i};
    mx = max(mx, w);
  }
  sort(a + 1, a + ss + 1, cmp);
  sort(b + 1, b + tt + 1, cmp);
  int l = -mx, r = mx, ans = -1;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (check(mid) >= k)
      l = mid + 1, ans = mid;
    else
      r = mid - 1;
  }
  int mid = ans;
  for (int i = 1; i <= n; i++) fa[i] = i;
  int i = 1, j = 1, cnt = 0, t, x, y, tot = 0, w, id;
  while (i <= ss && j <= tt) {
    if (a[i].w + mid <= b[j].w && cnt < k)
      x = find(a[i].u), y = find(a[i].v), t = 1, id = a[i].ind, i++;
    else
      x = find(b[j].u), y = find(b[j].v), t = 0, id = b[j].ind, j++;
    if (x != y) fa[x] = y, cnt += t, tot++, ind[++ksj] = id;
  }
  for (; i <= ss && cnt < k; i++) {
    x = find(a[i].u), y = find(a[i].v);
    if (x != y) fa[x] = y, cnt++, tot++, ind[++ksj] = a[i].ind;
  }
  for (; j <= tt; j++) {
    x = find(b[j].u), y = find(b[j].v);
    if (x != y) fa[x] = y, tot++, ind[++ksj] = b[j].ind;
  }
  if (tot != n - 1 || cnt != k) {
    puts("-1");
    return 0;
  }
  cout << n - 1 << '\n';
  for (int i = 1; i < n; i++) cout << ind[i] << ' ';
  return 0;
}