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], mx[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 dfs(int u, int f) {
  if (u == 0) return;
  dfs(pre[u], u);
  pre[u] = f;
}
int vis[N], sta[N], top;
void update() {
  memset(vis, 0, sizeof(vis));
  vis[0] = 1;
  mx[0] = 0;
  for (int i = 1; i < n; i++) {
    int j = i;
    top = 0;
    while (1) {
      sta[top++] = j;
      if (vis[j]) break;
      j = pre[j];
    }
    for (int j = top - 2; j >= 0; j--) {
      mx[sta[j]] = max(mx[sta[j + 1]], g[sta[j]][sta[j + 1]]);
      vis[sta[j]] = 1;
    }
  }
}
void Solve() {
  for (int i = 0; i < n; i++) {
    dis[i] = inf;
    clo[i] = pre[i] = fst[i] = 0;
  }
  int res = 0, cnt = 0;
  for (int i = 1; i < n; i++)
    if (!clo[i]) {
      res += Prim(i, ++cnt);
    }
  if (cnt > k) {
    printf("-1\n");
    return;
  }
  for (int 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 (int i = 1; i <= cnt; i++) {
    res += g[0][fst[i]];
    g[0][fst[i]] = g[fst[i]][0] = 0;
    dfs(fst[i], 0);
  }
  update();
  k = k - cnt;
  while (k--) {
    int tmp = 0;
    for (int i = 1; i < n; i++)
      if (g[0][i] != 0 && (tmp == 0 || g[0][tmp] - mx[tmp] > g[0][i] - mx[i]))
        tmp = i;
    res = res + g[0][tmp] - mx[tmp];
    g[0][tmp] = g[tmp][0] = 0;
    int p = 0;
    for (int i = tmp; i; i = pre[i])
      if (p == 0 || g[p][pre[p]] < g[i][pre[i]]) p = i;
    pre[p] = 0;
    dfs(tmp, 0);
    update();
  }
  printf("%d\n", n - 1);
  for (int i = 1; i < n; i++) {
    printf("%d", id[i][pre[i]] + 1);
    if (i == n - 1)
      printf("\n");
    else
      printf(" ");
  }
}
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;
}