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;
long long a, b, c, o, uu, h[100001], q, w, e, mm, v[5001], fa[5001], hh, cnt,
    r[100001], id, rr[100001];
struct p {
  long long q, w, e, id;
} l[200001], g[200001];
struct pp {
  long long q, w, e, id, o;
};
vector<pp> y;
vector<p> f, x;
void dfs(long long qq, long long ww) {
  for (int i = h[qq]; i; i = l[i].w) {
    if (l[i].q != ww && !r[i] && l[i].q != 1) {
      if (l[i].e >= l[v[qq]].e) {
        v[l[i].q] = i;
      } else
        v[l[i].q] = v[qq];
      dfs(l[i].q, qq);
    }
  }
}
bool cmp(p qq, p ww) { return qq.e < ww.e; }
long long find(long long qq) {
  if (qq == fa[qq]) return qq;
  return fa[qq] = find(fa[qq]);
}
int main() {
  for (int i = 1; i <= 5000; i++) {
    fa[i] = i;
  }
  o = 1;
  scanf("%lld%lld%lld", &a, &b, &c);
  for (int i = 1; i <= b; i++) {
    scanf("%lld%lld%lld", &q, &w, &e);
    f.push_back(p{q, w, e, i});
  }
  sort(f.begin(), f.end(), cmp);
  for (int i = 0; i < f.size(); i++) {
    if (f[i].q == 1 || f[i].w == 1) continue;
    long long f1 = find(f[i].q), f2 = find(f[i].w);
    if (f1 != f2) {
      fa[f1] = f2;
      q = f[i].q;
      w = f[i].w;
      e = f[i].e;
      id = f[i].id;
      o++;
      l[o].q = w;
      l[o].w = h[q];
      h[q] = o;
      l[o].e = e;
      l[o].id = id;
      o++;
      l[o].q = q;
      l[o].w = h[w];
      h[w] = o;
      l[o].e = e;
      l[o].id = id;
      y.push_back(pp{q, w, e, id, o});
    }
  }
  for (int i = 0; i < f.size(); i++) {
    if (f[i].q != 1 && f[i].w != 1) continue;
    long long f1 = find(f[i].q), f2 = find(f[i].w);
    if (f1 != f2) {
      fa[f1] = f2;
      q = f[i].q;
      w = f[i].w;
      e = f[i].e;
      id = f[i].id;
      o++;
      l[o].q = w;
      l[o].w = h[q];
      h[q] = o;
      l[o].e = e;
      l[o].id = id;
      o++;
      l[o].q = q;
      l[o].w = h[w];
      h[w] = o;
      l[o].e = e;
      l[o].id = id;
      y.push_back(pp{q, w, e, id, o});
      mm++;
    } else
      x.push_back(f[i]);
  }
  for (int i = 2; i <= a; i++) {
    if (find(i) != find(i - 1)) {
      printf("-1");
      return 0;
    }
  }
  if (mm > c) {
    printf("-1");
    return 0;
  }
  printf("%lld\n", a - 1);
  c -= mm;
  for (int ii = 1; ii <= c; ii++) {
    if (!x.size()) {
      printf("-1");
      return 0;
    }
    memset(v, 0, sizeof(v));
    for (int i = h[1]; i; i = l[i].w) {
      dfs(l[i].q, 1);
    }
    long long ff = 0x3f3f3f3f3f, yy = 0;
    for (int i = 0; i < x.size(); i++) {
      if (x[i].q == 1) {
        hh = x[i].w;
      } else
        hh = x[i].q;
      if (x[i].e - l[v[hh]].e < ff) {
        ff = x[i].e - l[v[hh]].e;
        yy = i;
      }
    }
    if (x[yy].q == 1) {
      hh = x[yy].w;
    } else
      hh = x[yy].q;
    r[v[hh]] = 1;
    r[v[hh] ^ 1] = 1;
    q = x[yy].q;
    w = x[yy].w;
    e = x[yy].e;
    id = x[yy].id;
    o++;
    l[o].q = w;
    l[o].w = h[q];
    h[q] = o;
    l[o].e = e;
    l[o].id = id;
    o++;
    l[o].q = q;
    l[o].w = h[w];
    h[w] = o;
    l[o].e = e;
    l[o].id = id;
    rr[l[v[hh]].id] = 1;
    y.push_back(pp{x[yy].q, x[yy].w, x[yy].e, x[yy].id, o});
    x.erase(x.begin() + yy);
  }
  for (int i = 0; i < y.size(); i++) {
    if (!rr[y[i].id]) {
      printf("%lld ", y[i].id);
    }
  }
  return 0;
}