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;
int countbit(int n) { return (n == 0) ? 0 : (1 + countbit(n & (n - 1))); }
int lowbit(int n) { return (n ^ (n - 1)) & n; }
const double pi = acos(-1.0);
const double eps = 1e-7;
template <class T>
T sqr(T x) {
  return x * x;
}
int N, M, K;
int p[5001], h[5001];
int path[5001];
int getRoot(int x) {
  if (p[x] == x) return x;
  return p[x] = getRoot(p[x]);
}
void unite(int x, int y) {
  int px = getRoot(x), py = getRoot(y);
  if (px == py) return;
  int hx = h[px], hy = h[py];
  if (hx > hy)
    p[py] = px;
  else if (hx < hy)
    p[px] = py;
  else
    p[px] = py, h[py]++;
}
struct Edge {
  int u, v;
  double w;
  int index;
  bool operator<(const Edge &obj) const { return w < obj.w; }
};
vector<Edge> e1, e2, e3, e;
int check(double x) {
  e3.clear();
  for (int _n = e1.size(), i = 0; i < _n; ++i) {
    Edge te = e1[i];
    te.w += x;
    e3.push_back(te);
  }
  e = e2;
  for (int _n = e1.size(), i = 0; i < _n; ++i) e.push_back(e3[i]);
  sort(e.begin(), e.end());
  int index = 0;
  for (int _n = N, i = 0; i < _n; ++i) h[i] = 1, p[i] = i;
  int ret = 0;
  for (int _n = M, i = 0; i < _n; ++i) {
    int u = e[i].u, v = e[i].v;
    int pu = getRoot(u), pv = getRoot(v);
    if (pu == pv) continue;
    unite(u, v);
    path[index++] = e[i].index;
    if (u == 0 || v == 0) ++ret;
    if (index == N - 1) break;
  }
  return ret;
}
int main() {
  scanf("%d %d %d", &N, &M, &K);
  e1.clear();
  e2.clear();
  for (int _n = M, i = 0; i < _n; ++i) {
    Edge te;
    scanf("%d %d %lf", &te.u, &te.v, &te.w);
    te.u--, te.v--, te.index = i + 1;
    if (te.u == 0 || te.v == 0)
      e1.push_back(te);
    else
      e2.push_back(te);
  }
  if (K == 0 && N != 1) {
    printf("-1\n");
    return 0;
  }
  for (int _n = e1.size(), i = 0; i < _n; ++i) e1[i].w += eps * i;
  double l = -100000, r = 100000, mid;
  while (r - l > eps) {
    mid = (l + r) / 2;
    if (check(mid) > K)
      l = mid;
    else
      r = mid;
  }
  if (check(l) != K) check(r);
  printf("%d\n", N - 1);
  for (int _n = N - 1, i = 0; i < _n; ++i) {
    if (i) printf(" ");
    printf("%d", path[i]);
  }
  printf("\n");
  return 0;
}