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;
struct node {
  int u, v, c, p, tip, next;
} g[50005 * 4], a[50005 * 2];
int head[50005], cnt, e, limit, n, m, vv[50005], vis[50005], u[50005],
    num[50005];
int d[50005], pos[50005], s, f[50005];
int cmp(node a, node b) { return a.c < b.c; }
void add(int a, int b, int c, int i) {
  g[cnt].u = a, g[cnt].v = b, g[cnt].c = c, g[cnt].next = head[a], g[cnt].p = i;
  g[cnt].tip = 0;
  head[a] = cnt++;
}
int getf(int a) {
  if (a == f[a]) return a;
  return f[a] = getf(f[a]);
}
void dfs(int u, int s, int l) {
  d[u] = s;
  pos[u] = l;
  vv[u] = 1;
  int i, j;
  for (i = head[u]; i + 1; i = g[i].next) {
    j = g[i].v;
    if (!vv[j] && !g[i].tip) {
      int k = l;
      if (g[i].c > s) k = i;
      dfs(j, max(g[i].c, s), k);
    }
  }
}
void work() {
  int i, k;
  memset(vv, 0, sizeof(vv));
  for (i = 1; i <= n; i++)
    if (vis[i]) dfs(i, 0, 0);
  while (e < limit) {
    int min = 0xfffffff;
    k = 0;
    for (i = 2; i <= n; i++) {
      if (vis[i] || !u[i]) continue;
      if (min > u[i] - d[i]) {
        min = u[i] - d[i];
        k = i;
      }
    }
    if (k == 0) break;
    vis[k] = 1;
    s += min;
    d[k] = 0;
    g[pos[k]].tip = 1;
    g[pos[k] ^ 1].tip = 1;
    memset(vv, 0, sizeof(vv));
    for (i = 1; i <= n; i++)
      if (vis[i]) dfs(i, 0, 0);
    e++;
  }
}
int main() {
  int i;
  while (~scanf("%d%d%d", &n, &m, &limit)) {
    s = 0;
    for (i = 0; i < m; i++) {
      scanf("%d%d%d", &a[i].u, &a[i].v, &a[i].c);
      a[i].p = i;
      a[i].tip = 0;
      if (a[i].u == 1) u[a[i].v] = a[i].c, num[a[i].v] = i;
      if (a[i].v == 1) u[a[i].u] = a[i].c, num[a[i].u] = i;
    }
    sort(a, a + m, cmp);
    for (i = 1; i <= n; i++) f[i] = i;
    for (i = 0; i < m; i++) {
      if (a[i].u == 1 || a[i].v == 1) continue;
      int f1 = getf(a[i].u), f2 = getf(a[i].v);
      if (f1 == f2) continue;
      s += a[i].c;
      if (f1 > f2) swap(f1, f2);
      f[f2] = f1;
      a[i].tip = 1;
    }
    e = 0;
    memset(vis, 0, sizeof(vis));
    for (i = 0; i < m; i++) {
      if (a[i].u == 1) {
        int f1 = getf(a[i].v);
        if (f1 == 1) continue;
        s += a[i].c;
        a[i].tip = 1;
        vis[a[i].v] = 1;
        f[f1] = 1;
        e++;
      } else if (a[i].v == 1) {
        int f1 = getf(a[i].u);
        if (f1 == 1) continue;
        s += a[i].c;
        a[i].tip = 1;
        vis[a[i].u] = 1;
        f[f1] = 1;
        e++;
      }
      if (e == limit) break;
    }
    cnt = 0;
    memset(head, -1, sizeof(head));
    for (i = 0; i < m; i++) {
      if (a[i].tip && a[i].u != 1 && a[i].v != 1) {
        add(a[i].u, a[i].v, a[i].c, a[i].p);
        add(a[i].v, a[i].u, a[i].c, a[i].p);
      }
    }
    for (i = 2; i <= n; i++) {
      int f1 = getf(i);
      if (f1 != 1) break;
    }
    if (i != n + 1) {
      printf("-1\n");
      continue;
    }
    work();
    if (e != limit) {
      printf("-1\n");
      continue;
    }
    printf("%d\n", n - 1);
    for (i = 2; i <= n; i++)
      if (vis[i]) printf("%d ", num[i] + 1);
    for (i = 0; i < cnt; i++)
      if (!g[i].tip) {
        printf("%d ", g[i].p + 1);
        g[i].tip = g[i ^ 1].tip = 1;
      }
    printf("\n");
  }
  return 0;
}