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;
struct edge {
  int cost;
  int u, v;
  double cost2;
  int id;
  edge() {}
  edge(int a, int b, double c, int d) : u(a), v(b), cost(c), id(d) {}
};
bool cmp(const edge &e1, const edge &e2) { return e1.cost2 < e2.cost2; }
struct UnionFind {
  int par[5500];
  int rank[5500];
  void init(int N) {
    for (int i = 0; i < N; i++) {
      par[i] = i;
      rank[i] = 0;
    }
  }
  int find(int v) {
    if (par[v] == v) return v;
    return par[v] = find(par[v]);
  }
  void unite(int u, int v) {
    u = find(u), v = find(v);
    if (u == v) return;
    if (rank[u] < rank[v])
      par[u] = v;
    else
      par[v] = u;
    if (rank[u] == rank[v]) rank[u]++;
  }
  bool same(int u, int v) { return find(u) == find(v); }
};
edge es[100100], tmp[100100];
edge ans[5500];
UnionFind uf;
int N, M, K;
pair<int, int> check(double w) {
  for (int i = 0; i < M; i++) {
    tmp[i] = es[i];
    if (es[i].u == 0) {
      tmp[i].cost2 = tmp[i].cost + w;
    } else {
      tmp[i].cost2 = tmp[i].cost;
    }
  }
  sort(tmp, tmp + M, cmp);
  uf.init(N);
  int weight = 0, cnt = 0;
  int c = 0;
  for (int i = 0; i < M; i++) {
    int u = tmp[i].u, v = tmp[i].v;
    if (uf.same(u, v)) continue;
    uf.unite(u, v);
    if (u == 0) {
      cnt++;
    }
    weight += tmp[i].cost;
    ans[c] = tmp[i];
    c++;
  }
  return pair<int, int>(weight, cnt);
}
int main() {
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 0; i < M; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    a--;
    b--;
    if (a > b) swap(a, b);
    es[i] = edge(a, b, c, i);
  }
  double lb = -100000, ub = 100000;
  bool ok = false;
  for (int stage = 0; stage < 100; stage++) {
    double mid = (ub + lb) / 2;
    pair<int, int> p = check(mid);
    if (p.second > K)
      lb = mid;
    else if (p.second == K) {
      lb = mid;
      ok = true;
      break;
    } else
      ub = mid;
  }
  pair<int, int> p = check(lb);
  if (!ok)
    printf("-1\n");
  else {
    printf("%d\n", N - 1);
    for (int i = 0; i < N - 1; i++) {
      printf("%d%c", ans[i].id + 1, i == N - 2 ? '\n' : ' ');
    }
  }
  return 0;
}