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 int MAX_N = 5000 + 10;
struct DisJoinSet {
  int fa[MAX_N], n;
  void init(int _n) {
    n = _n;
    for (int i = 0; i < n; ++i) {
      fa[i] = i;
    }
  }
  int find(int x) {
    if (fa[x] == x) return x;
    return fa[x] = find(fa[x]);
  }
  bool unite(int a, int b) {
    a = find(a), b = find(b);
    fa[a] = b;
    return a != b;
  }
} djs;
struct Edge {
  int a, b, id;
  double c;
  Edge() {}
  Edge(int _a, int _b, double _c, int _id) : a(_a), b(_b), c(_c), id(_id) {}
  bool operator<(const Edge& e) const { return c < e.c; }
  bool isCaptial() { return !a || !b; }
};
vector<Edge> ce, ne;
const int MAX_M = int(1e5) + 10;
int n, m, k;
vector<Edge> mst;
int eval(double delta, int nCnt = -1) {
  static Edge es[MAX_M];
  for (vector<Edge>::iterator e = ce.begin(); e != ce.end(); ++e) {
    e->c += delta;
  }
  merge(ce.begin(), ce.end(), ne.begin(), ne.end(), es) - es;
  djs.init(n);
  int cnt = 0;
  mst.clear();
  for (int i = 0; i < m; ++i) {
    if (es[i].isCaptial() && cnt == nCnt) continue;
    if (djs.unite(es[i].a, es[i].b)) {
      mst.push_back(es[i]);
      if (es[i].isCaptial()) {
        ++cnt;
      }
    }
  }
  for (vector<Edge>::iterator e = ce.begin(); e != ce.end(); ++e) {
    e->c -= delta;
  }
  return cnt;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c), --a, --b;
    Edge e(a, b, c, i + 1);
    if (e.isCaptial()) {
      ce.push_back(e);
    } else {
      ne.push_back(e);
    }
  }
  sort(ce.begin(), ce.end());
  sort(ne.begin(), ne.end());
  double L = -1e6, R = 1e6;
  eval(0);
  if (mst.size() < n - 1) {
    cout << "-1" << endl;
    return 0;
  }
  int mx = eval(L), mi = eval(R);
  if (mx < k || mi > k) {
    puts("-1");
    return 0;
  }
  for (int i = 0; i < 100; ++i) {
    double M = (L + R) / 2;
    if (eval(M) >= k) {
      L = M;
    } else {
      R = M;
    }
  }
  eval(L, k);
  cout << mst.size() << endl;
  for (vector<Edge>::iterator e = mst.begin(); e != mst.end(); ++e) {
    printf("%d ", e->id);
  }
  printf("\n");
  return 0;
}