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 N = 5e5 + 5, US = 1e9;
char buf[1 << 23], *p1 = buf, *p2 = buf;
long long n, m, s, k;
long long fa[N], w[N], as[N], ans;
int ce, cf;
struct aa {
  int u, v;
  long long w;
  int id;
  bool operator<(const aa &b) const { return w < b.w; }
} e[N], f[N];
int read() {
  int res = 0, fl = 0;
  char a = getchar();
  while (a < '0' || a > '9') fl |= a == '-', a = getchar();
  while (a >= '0' && a <= '9') res = res * 10 + a - '0', a = getchar();
  return fl ? -res : res;
}
bool cmp(int a, int b) { return w[a] < w[b]; }
int getf(int x) { return fa[x] == x ? x : fa[x] = getf(fa[x]); }
long long wk(long long x) {
  long long pa = (x % (cf + 1) + cf + 1) % (cf + 1), pb = (x - pa) / (cf + 1),
            i, j, li, res = 0;
  for (i = 1; i <= n; i++) fa[i] = i;
  for (i = 1, j = 1, li = 0; (i <= ce || j <= cf) && li < n - 1;) {
    aa lp;
    if (i > ce)
      lp = f[j++];
    else if (j > cf)
      lp = e[i++];
    else
      lp = (e[i].w == f[j].w + pb  ? j > pa ? f[j++] : e[i++]
             : e[i].w < f[j].w + pb ? e[i++]
                                   : f[j++]);
    int la = getf(lp.u), lb = getf(lp.v);
    if (la != lb) fa[la] = lb, res += lp.u == 1, li++;
  }
  return res;
}
int fan[N];
int main() {
  int i, j, li;
  n = read(), m = read(), s = 1, k = read();
  for (i = 1; i <= n; i++) fan[i] = i;
  swap(fan[1], fan[s]);
  for (i = 1; i <= m; i++) {
    int lu = fan[read()], lv = fan[read()], lw = w[i] = read();
    lu > lv && (swap(lu, lv), 0), lu == 1 && (f[++cf] = aa{lu, lv, lw, i}, 0),
        lu > 1 && (e[++ce] = aa{lu, lv, lw, i}, 0);
  }
  sort(e + 1, e + ce + 1), sort(f + 1, f + cf + 1);
  if (cf < k) return cout << -1, 0;
  long long pl = 0, pr = US * (cf + 1) * 2;
  while (pl < pr) {
    long long mid = (pl + pr) / 2;
    if (wk(mid - US * (cf + 1)) <= k)
      pr = mid;
    else
      pl = mid + 1;
  }
  if (pl == US * (cf + 1) * 2) return cout << -1, 0;
  pl -= US * (cf + 1);
  long long pa = (pl % (cf + 1) + cf + 1) % (cf + 1), pb = (pl - pa) / (cf + 1);
  for (i = 1; i <= n; i++) fa[i] = i;
  for (i = 1, j = 1, li = 0; (i <= ce || j <= cf) && li < n - 1;) {
    aa lp;
    if (i > ce)
      lp = f[j++];
    else if (j > cf)
      lp = e[i++];
    else
      lp = (e[i].w == f[j].w + pb  ? j > pa ? f[j++] : e[i++]
             : e[i].w < f[j].w + pb ? e[i++]
                                   : f[j++]);
    int la = getf(lp.u), lb = getf(lp.v);
    if (la != lb) fa[la] = lb, li++, as[++as[0]] = lp.id;
  }
  cout << as[0] << '\n';
  for (i = 1; i < n; i++) cout << as[i] << ' ';
  return 0;
}