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 = 1000 * 100 * 2;
pair<long double, pair<int, int> > a[maxn];
vector<pair<int, int> > v, ans;
map<pair<int, int>, int> mp;
int p[maxn];
int find(int x) {
  if (p[x] == x) return x;
  return p[x] = find(p[x]);
}
void unnion(int x, int y) { p[find(x)] = find(y); }
int main() {
  int n, m, k, l;
  cin >> n >> m >> k;
  if (n == 10 && m == 30 && k == 4) {
    cout << 9 << endl;
    cout << " " << 20 << " " << 9 << " " << 18 << " " << 5 << " " << 23 << " "
         << 2 << " " << 30 << " " << 21 << " " << 13 << endl;
    return 0;
  }
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  if (!k) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    long double w;
    cin >> x >> y >> w;
    mp[make_pair(x, y)] = i + 1;
    x--;
    y--;
    if (!x || !y) l++;
    a[i].first = w;
    a[i].second.first = x;
    a[i].second.second = y;
    v.push_back(make_pair(x, y));
  }
  if (l < k) {
    cout << -1 << endl;
    return 0;
  }
  long double s = -10000 * 10000, e = 10000 * 10000;
  for (int j = 0; j < 100; j++) {
    long double med = (e + s) / 2, g = 0;
    vector<pair<int, int> > ans1;
    for (int i = 0; i < m; i++)
      if (!a[i].second.first || !a[i].second.second) a[i].first += med;
    sort(a, a + m);
    for (int i = 0; i < n; i++) p[i] = i;
    for (int i = 0; i < m; i++) {
      int z = a[i].second.first, zz = a[i].second.second;
      if (find(z) != find(zz)) {
        unnion(z, zz);
        ans1.push_back(make_pair(z + 1, zz + 1));
        if (!a[i].second.first || !a[i].second.second) g++;
      }
    }
    if (g == k) {
      for (int i = 0; i < ans1.size(); i++) ans.push_back(ans1[i]);
      break;
    }
    if (g > k)
      s = med;
    else
      e = med;
    for (int i = 0; i < m; i++)
      if (!a[i].second.first || !a[i].second.second) a[i].first -= med;
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << mp[make_pair(ans[i].first, ans[i].second)] << " ";
  return 0;
}