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 long long N = 5005;
long long n, m, k;
long long p[N], id[N];
vector<pair<pair<long double, long long>, pair<long long, long long> > > q;
vector<pair<long long, pair<long long, long long> > > edges[200005];
vector<pair<long long, pair<long long, long long> > > edges2;
void initialise() {
  for (long long i = 0; i < N; ++i) id[i] = i;
}
long long root(long long x) {
  while (id[x] != x) {
    id[x] = id[id[x]];
    x = id[x];
  }
  return x;
}
void union1(long long x, long long y) {
  long long p = root(x);
  long long q = root(y);
  id[p] = id[q];
}
long long kruskal(vector<pair<long long, pair<long long, long long> > > p) {
  initialise();
  long long x, y;
  long long count = 0;
  long long cost, minimumCost = 0;
  for (long long i = 0; i < p.size(); ++i) {
    x = p[i].second.first;
    y = p[i].second.second;
    cost = p[i].first;
    if (root(x) != root(y)) {
      count++;
      minimumCost += cost;
      union1(x, y);
      if (count == (n - 1)) return minimumCost;
    }
  }
  if (count < (n - 1)) return -1;
  return minimumCost;
}
vector<long long> ans;
long long check(long double val) {
  for (auto &it : q) {
    if (it.second.first == 1 || it.second.second == 1) {
      it.first.first += val;
    }
  }
  sort(q.begin(), q.end());
  for (long long i = 1; i <= n; i++) {
    id[i] = i;
  }
  long long cur = 0;
  ans.clear();
  for (auto it : q) {
    long long x = it.second.first, y = it.second.second;
    if (root(x) != root(y)) {
      if (x == 1 || y == 1) {
        cur++;
      }
      ans.push_back(it.first.second);
      id[root(x)] = root(y);
    }
  }
  for (auto &it : q) {
    if (it.second.first == 1 || it.second.second == 1) {
      it.first.first -= val;
    }
  }
  return cur;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  if (k > n) {
    cout << "-1";
    return 0;
  }
  for (long long i = 1; i <= m; i++) {
    long long x, y, z;
    cin >> x >> y >> z;
    q.push_back(make_pair(make_pair(z, i), make_pair(x, y)));
    edges[i].push_back({z, {x, y}});
  }
  long double l = -1e12, r = 1e12;
  for (long long i = 1; i <= 120; i++) {
    long double mid = (r + l) / 2;
    long long x = check(mid);
    if (x == k && (long long)ans.size() == n - 1) {
      cout << n - 1 << "\n";
      for (long long i = 0; i < ans.size(); i++) {
        cout << ans[i] << " ";
        auto v = edges[ans[i]][0];
        edges2.push_back(v);
      }
      sort(edges2.begin(), edges2.end());
      long long fin1 = kruskal(edges2);
      return 0;
    }
    if (x > k) {
      l = mid;
    } else {
      r = mid;
    }
  }
  if (check(r) == k && ans.size() == n - 1) {
    cout << n - 1 << "\n";
    for (long long i = 0; i < ans.size(); i++) {
      cout << ans[i] << " ";
      auto v = edges[ans[i]][0];
      edges2.push_back(v);
    }
  } else if (check(l) == k && ans.size() == n - 1) {
    cout << n - 1 << "\n";
    for (long long i = 0; i < ans.size(); i++) {
      cout << ans[i] << " ";
      auto v = edges[ans[i]][0];
      edges2.push_back(v);
    }
  } else {
    cout << "-1";
    return 0;
  }
  sort(edges2.begin(), edges2.end());
  long long fin = kruskal(edges2);
}