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 N = 5000 + 10;
const int inf = 1 << 30;
int g[N][N], dis[N], clo[N], pre[N], fst[N], max_side[N], id[N][N];
int n, m, k;
int Prim(int src, int id) {
  dis[src] = 0;
  int ans = 0;
  while (1) {
    int u = -1;
    for (int i = 1; i < n; i++) {
      if (!clo[i] && dis[i] != inf) {
        if (u == -1 || dis[u] > dis[i]) u = i;
      }
    }
    if (u == -1) break;
    clo[u] = id;
    ans += dis[u];
    for (int i = 1; i < n; i++)
      if (!clo[i] && g[u][i] != 0 && dis[i] > g[u][i]) {
        pre[i] = u;
        dis[i] = g[u][i];
      }
  }
  return ans;
}
void update(int cur, int last, int maxside) {
  max_side[cur] = maxside > g[cur][last] ? maxside : g[cur][last];
  for (int i = 1; i < n; i++)
    if (i != last && g[cur][i] != 0 && (pre[cur] == i || pre[i] == cur)) {
      update(i, cur, max_side[cur]);
    }
  pre[cur] = last;
}
int res;
void Solve() {
  int i, cnt;
  for (i = 0; i < n; i++) {
    dis[i] = inf;
    clo[i] = pre[i] = fst[i] = 0;
  }
  res = 0, cnt = 0;
  for (i = 1; i < n; i++)
    if (!clo[i]) {
      res += Prim(i, ++cnt);
    }
  if (cnt > k) {
    printf("-1\n");
    return;
  }
  for (i = 1; i < n; i++) {
    int id = clo[i];
    if (g[0][i] != 0 && (!fst[id] || g[0][i] < g[0][fst[id]])) fst[id] = i;
  }
  for (int i = 1; i <= cnt; i++) {
    if (!fst[i]) {
      printf("-1\n");
      return;
    }
  }
  for (i = 1; i <= cnt; i++) {
    res += g[0][fst[i]];
    g[0][fst[i]] = g[fst[i]][0] = 0;
    update(fst[i], 0, 0);
  }
  k = k - cnt;
  while (k--) {
    int tmp = 0;
    for (i = 1; i < n; i++)
      if (g[0][i] != 0 &&
          (tmp == 0 || max_side[tmp] - g[0][tmp] < max_side[i] - g[0][i]))
        tmp = i;
    if (tmp == 0) {
      printf("-1\n");
      continue;
    }
    res = res - max_side[tmp] + g[0][tmp];
    g[0][tmp] = g[tmp][0] = 0;
    int p = 0;
    for (i = tmp; pre[i] != 0; i = pre[i])
      if (p == 0 || g[p][pre[p]] < g[i][pre[i]]) p = i;
    pre[p] = 0;
    update(tmp, 0, 0);
  }
  printf("%d\n", n - 1);
  for (int i = 1; i < n; i++) {
    printf("%d", id[i][pre[i]] + 1);
    if (i < n - 1)
      printf(" ");
    else
      printf("\n");
  }
}
int main() {
  while (scanf("%d%d%d", &n, &m, &k) != EOF) {
    memset(g, 0, sizeof(g));
    int cnt = 0;
    for (int i = 0; i < m; i++) {
      int u, v, w;
      scanf("%d%d%d", &u, &v, &w);
      u--;
      v--;
      if (!g[u][v] || g[u][v] > w) g[u][v] = g[v][u] = w;
      id[u][v] = id[v][u] = i;
      if (u == 0 || v == 0) cnt++;
    }
    if (n > 1 && !k || cnt < k) {
      printf("-1\n");
      continue;
    }
    Solve();
  }
  return 0;
}