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;
inline char gc() {
  static char buf[1 << 14], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 14, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read(int &x) {
  x = 0;
  bool f = 1;
  char c = gc();
  for (; !isdigit(c); c = gc()) {
    if (c == '-') f ^= 1;
    if (c == -1) return -1;
  }
  for (; isdigit(c); c = gc()) x = (x << 1) + (x << 3) + (c ^ 48);
  x = f ? x : -x;
  return 1;
}
inline void wr(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) wr(x / 10);
  putchar(x % 10 | 48);
}
const int N = 1e5 + 10;
int n, m, k, fa[N], l, r, cnt, ans;
struct node {
  int x, y, v, c, id;
  bool operator<(const node &res) const {
    return v < res.v || (v == res.v && c < res.c);
  }
} a[N];
inline int fid(int x) { return x == fa[x] ? x : fa[x] = fid(fa[x]); }
inline int check(int add, bool flag = 0) {
  for (int i = 1; i <= n; ++i) fa[i] = i;
  for (int i = 1; i <= m; ++i)
    if (!a[i].c) a[i].v += add;
  int tot = 0;
  sort(a + 1, a + 1 + m);
  for (int i = 1; i <= m; ++i) {
    int t1 = fid(a[i].x), t2 = fid(a[i].y);
    if (t1 == t2) continue;
    if (flag && tot == k && !a[i].c) continue;
    fa[t1] = t2;
    tot += !a[i].c;
    if (flag) wr(a[i].id), putchar(' ');
  }
  for (int i = 1; i <= m; ++i)
    if (!a[i].c) a[i].v -= add;
  return tot >= k;
}
int main() {
  read(n), read(m), read(k);
  for (int i = 1; i <= m; ++i)
    read(a[i].x), read(a[i].y), read(a[i].v),
        a[i].c = (a[i].x != 1 && a[i].y != 1), a[i].id = i, cnt += !a[i].c;
  if (cnt < k || (!k && n > 1)) return puts("-1"), 0;
  l = -1e5 - 10, r = 1e5 + 10;
  for (int mid; l <= r;
       check(mid = (l + r) >> 1) ? ans = mid, l = mid + 1 : r = mid - 1)
    ;
  wr(n - 1), puts("");
  check(ans, 1);
  return 0;
}