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 maxN = 5000 + 10;
const int maxE = 100000 + 10;
const double eps = 1e-10;
int n, e, k;
int par[maxN];
vector<int> ans;
struct edge {
  int e1, e2, id;
  double w;
  edge() {}
  edge(int _e1, int _e2, int _id, double _w) {
    e1 = _e1, e2 = _e2, id = _id, w = _w;
    if (e1 > e2) swap(e1, e2);
  }
  bool operator<(const edge &SEC) const {
    return (abs(w - SEC.w) > eps) ? (w < SEC.w) : (e1 > SEC.e1);
  }
} yal[maxE], a[maxE];
int root(int x) { return (par[x] != x) ? (par[x] = root(par[x])) : (x); }
int kruskal(double mid) {
  for (int i = 1; i <= e; i++) {
    if (yal[i].e1 == 1)
      a[i] = edge(yal[i].e1, yal[i].e2, yal[i].id, yal[i].w + mid);
    else
      a[i] = yal[i];
  }
  sort(a + 1, a + e + 1);
  ans.clear();
  for (int i = 1; i <= n; i++) par[i] = i;
  int ret = 0;
  for (int i = 1; i <= e; i++)
    if (root(a[i].e1) != root(a[i].e2)) {
      par[root(a[i].e2)] = root(a[i].e1);
      ans.push_back(a[i].id);
      ret += (a[i].e1 == 1);
    }
  if ((int)ans.size() < n - 1) return -1;
  return ret;
}
int main() {
  scanf("%d%d%d", &n, &e, &k);
  for (int i = 1; i <= e; i++) {
    int e1, e2, w;
    scanf("%d%d%d", &e1, &e2, &w);
    yal[i] = edge(e1, e2, i, w);
  }
  sort(yal + 1, yal + e + 1);
  for (int i = 1; i <= e; i++) {
    int j = i;
    while (j <= e && abs(yal[i].w - yal[j].w) < eps) j++;
    for (int k = i; k < j; k++) yal[i].w += eps * (k - i);
    i = j - 1;
  }
  double lo = -1e6, hi = 1e6;
  for (int REP = 1; REP <= 70; REP++) {
    double mid = (lo + hi) / 2;
    int tmp = kruskal(mid);
    if (tmp == k) {
      printf("%d\n", n - 1);
      for (int i = 0; i < (int)ans.size(); i++) printf("%d ", ans[i]);
      printf("\n");
      return 0;
    }
    if (tmp < k) hi = mid;
    if (tmp > k) lo = mid;
  }
  printf("-1\n");
  return 0;
}