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 mod = 1e9 + 7, siz = 1e6 + 5;
long long t, timer, n, m, taken, sz[siz], k, include[siz], par[siz], cnt;
struct E {
  long long x, y, w, in, id;
} edg[siz];
bool cmp(E a, E b) {
  if (a.w != b.w) return a.w < b.w;
  return a.x < b.x;
}
long long get_par(long long u) {
  if (!par[u]) return u;
  return par[u] = get_par(par[u]);
}
void merg(long long u, long long v) {
  if (sz[u] < sz[v]) swap(u, v);
  sz[u] += sz[v];
  par[v] = u;
}
void kruskal(long long tomin) {
  for (long long i = 1; i <= m; i++)
    edg[i].w = edg[i].in + (edg[i].x == 1 ? tomin : 0);
  for (long long i = 1; i <= n; i++) par[i] = 0, sz[i] = 0;
  sort(edg + 1, edg + 1 + m, cmp);
  taken = 0;
  cnt = 0;
  for (long long i = 1; i <= m; i++) {
    long long u = edg[i].x, v = edg[i].y;
    u = get_par(u);
    v = get_par(v);
    if (u == v) continue;
    if (edg[i].x == 1 and taken == k) continue;
    taken += (edg[i].x == 1);
    include[++cnt] = edg[i].id;
    merg(u, v);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (long long i = 1; i <= m; i++) {
    cin >> edg[i].x >> edg[i].y >> edg[i].in, edg[i].id = i;
    if (edg[i].x > edg[i].y) swap(edg[i].x, edg[i].y);
  }
  kruskal(-100000);
  if (taken < k or cnt < n - 1) return cout << -1 << endl, 0;
  long long l = -100000, r = 100000;
  long long mins = -1;
  while (l <= r) {
    long long mid = l + (r - l) / 2;
    kruskal(mid);
    if (taken >= k) {
      mins = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  kruskal(mins);
  cout << n - 1 << endl;
  for (long long i = 1; i < n; i++) cout << include[i] << " ";
}