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 oo = 0x3f3f3f3f;
struct edge {
  int u, v, w, num;
  bool operator<(const edge &e) const { return w < e.w; }
} a[100010];
int fir[5010], ne[200010], to[200010], len[200010], in[100010], fa[5010],
    mn[5010], id1[5010], bel[5010], dp[5010], id2[5010], n, m, k, ans, cnt;
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
void add(int num, int u, int v, int w) {
  ne[num] = fir[u];
  fir[u] = num;
  to[num] = v;
  len[num] = w;
}
bool init() {
  int i;
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i <= n; i++) fa[i] = i;
  for (i = 1; i <= m; i++) {
    a[i].num = i;
    scanf("%d%d%d", &a[i].u, &a[i].v, &a[i].w);
    add(i * 2, a[i].u, a[i].v, a[i].w);
    add(i * 2 + 1, a[i].v, a[i].u, a[i].w);
    fa[find(a[i].u)] = find(a[i].v);
  }
  for (i = 1; i < n; i++)
    if (find(i) != find(i + 1)) return 0;
  return 1;
}
bool make() {
  int i, u, v;
  sort(a + 1, a + m + 1);
  for (i = 1; i <= n; i++) fa[i] = i;
  for (i = 1; i <= m; i++)
    if (find(u = a[i].u) != find(v = a[i].v) && u != 1 && v != 1) {
      ans += a[i].w;
      in[a[i].num] = 1;
      fa[fa[u]] = fa[v];
    }
  for (i = 2; i <= n; i++)
    if (find(i) == i) bel[i] = ++cnt;
  for (i = 1; i <= n; i++) bel[i] = bel[find(i)];
  if (cnt > k) return 0;
  for (i = 1; i <= cnt; i++) mn[i] = oo;
  for (i = fir[1]; i; i = ne[i])
    if (len[i] < mn[bel[to[i]]]) {
      mn[bel[to[i]]] = len[i];
      id1[bel[to[i]]] = i / 2;
    }
  for (i = 1; i <= cnt; i++) {
    ans += mn[i];
    in[id1[i]] = 1;
  }
  return 1;
}
void dfs(int u, int fa) {
  int i;
  for (i = fir[u]; i; i = ne[i])
    if (in[i / 2] && to[i] != fa) {
      if (u == 1)
        dp[to[i]] = -oo;
      else {
        if (len[i] > dp[u]) {
          dp[to[i]] = len[i];
          id2[to[i]] = i / 2;
        } else {
          dp[to[i]] = dp[u];
          id2[to[i]] = id2[u];
        }
      }
      dfs(to[i], u);
    }
}
void solve() {
  int i, j, t1, t2, t3;
  for (i = cnt + 1; i <= k; i++) {
    dfs(1, -1);
    t1 = oo;
    for (j = fir[1]; j; j = ne[j])
      if (!in[j / 2] && len[j] - dp[to[j]] < t1) {
        t1 = len[j] - dp[to[j]];
        t2 = j / 2;
        t3 = id2[to[j]];
      }
    ans += t1;
    in[t3] = 0;
    in[t2] = 1;
  }
  printf("%d\n", n - 1);
  for (i = 1; i <= m; i++)
    if (in[i]) printf("%d ", i);
}
int main() {
  if (!init() || !make())
    printf("-1\n");
  else
    solve();
}