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 = 5050;
const int M = (int)1e5 + 10;
int n, m, k, ans, du;
int E[M][3], id[M], used[M], G[N][N][2], ch[N];
int fa[N], dp[N];
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
bool cmp(int a, int b) { return E[a][2] < E[b][2]; }
void dfs(int u, int pre) {
  for (int j = 1; j <= ch[u]; j++) {
    int v = G[u][j][0], p = G[u][j][1];
    if (v == pre) continue;
    if (u == 1)
      dp[v] = 0;
    else if (E[dp[u]][2] > E[p][2])
      dp[v] = dp[u];
    else
      dp[v] = p;
    dfs(v, u);
  }
}
void del(int u, int v) {
  int pos = 0;
  for (int i = 1; i <= ch[u] && !pos; i++) pos = G[u][i][0] == v ? i : 0;
  for (int i = pos; i < ch[u]; i++)
    G[u][i][0] = G[u][i + 1][0], G[u][i][1] = G[u][i + 1][1];
  ch[u]--;
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= m; i++) scanf("%d %d %d", E[i] + 0, E[i] + 1, E[i] + 2);
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++) id[i] = i;
  sort(id + 1, id + m + 1, cmp);
  for (int i = 1; i <= m; i++) {
    int p = id[i];
    int a = E[p][0], b = E[p][1];
    if (find(a) != find(b) && a != 1 && b != 1) {
      fa[find(a)] = find(b);
      used[p] = 1;
      G[a][++ch[a]][0] = b, G[a][ch[a]][1] = p;
      G[b][++ch[b]][0] = a, G[b][ch[b]][1] = p;
      ans += E[p][2];
    }
  }
  for (int i = 1; i <= m; i++) {
    int p = id[i];
    int a = E[p][0], b = E[p][1];
    if (find(a) != find(b) && (a == 1 || b == 1)) {
      fa[find(a)] = find(b);
      used[p] = 1;
      G[a][++ch[a]][0] = b, G[a][ch[a]][1] = p;
      G[b][++ch[b]][0] = a, G[b][ch[b]][1] = p;
      ans += E[p][2];
      du++;
    }
  }
  while (du < k) {
    dfs(1, 0);
    int find = 0, tmp = M, _i, _j;
    for (int i = 1; i <= m; i++) {
      int p = id[i];
      int a = E[p][0], b = E[p][1];
      if (used[p]) continue;
      if (a != 1 && b != 1) continue;
      int v = a == 1 ? b : a;
      find = 1;
      if (tmp > E[p][2] - E[dp[v]][2])
        tmp = E[p][2] - E[dp[v]][2], _i = p, _j = dp[v];
    }
    if (!find) break;
    del(E[_j][0], E[_j][1]);
    del(E[_j][1], E[_j][0]);
    int v = E[_i][0] == 1 ? E[_i][1] : E[_i][0];
    G[1][++ch[1]][0] = v, G[1][ch[1]][1] = _i;
    G[v][++ch[v]][0] = 1, G[v][ch[v]][1] = _i;
    du++;
    used[_j] = 0;
    used[_i] = 1;
  }
  if (k != du)
    printf("-1");
  else {
    printf("%d\n", n - 1);
    for (int i = 1; i <= m; i++)
      if (used[i]) printf("%d ", i);
  }
  return 0;
}