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, w, id, f;
  bool operator<(const node &a) const { return w < a.w; }
} e[100010];
struct edge {
  int v, w, id, next, f;
} g[5010 << 2];
vector<int> q, v;
int f[5010], cnt, head[5010], d[5010], b[5010];
int find(int a) {
  if (a == f[a]) return a;
  return f[a] = find(f[a]);
}
void add(int a, int b, int c, int id) {
  g[cnt].v = b, g[cnt].w = c, g[cnt].id = id, g[cnt].next = head[a],
  g[cnt].f = 1, head[a] = cnt++;
  g[cnt].v = a, g[cnt].w = c, g[cnt].id = id, g[cnt].next = head[b],
  g[cnt].f = 1, head[b] = cnt++;
}
void dfs(int u, int fa) {
  for (int i = head[u]; i + 1; i = g[i].next) {
    int j = g[i].v, w = g[i].w;
    if (j == fa || !g[i].f) continue;
    if (u != 1) {
      d[j] = w;
      b[j] = i;
      if (d[j] < d[u]) {
        d[j] = d[u];
        b[j] = b[u];
      }
    }
    dfs(j, u);
  }
}
int main() {
  int i, j, k, m, n;
  while (~scanf("%d%d%d", &n, &m, &k)) {
    for (i = 0; i < m; i++) {
      scanf("%d%d%d", &e[i].u, &e[i].v, &e[i].w);
      e[i].id = i + 1;
      if (e[i].u > e[i].v) swap(e[i].u, e[i].v);
      e[i].f = 0;
    }
    if (k == 0) {
      if (n == 1)
        puts("0");
      else
        puts("-1");
      continue;
    }
    sort(e, e + m);
    for (i = 1; i <= n; i++) f[i] = i;
    q.clear();
    v.clear();
    for (i = 0; i < m; i++)
      if (e[i].u == 1)
        q.push_back(i);
      else {
        int a = find(e[i].u), b = find(e[i].v);
        if (a != b) {
          e[i].f = 1;
          f[b] = a;
        }
      }
    int tot = 0, num = 0;
    for (i = 2; i <= n; i++)
      if (f[i] == i) tot++;
    if (tot > k || (int)q.size() < tot) {
      puts("-1");
      continue;
    }
    for (i = 0; i < (int)q.size(); i++) {
      j = q[i];
      int a = find(e[j].v);
      if (a != 1) {
        f[a] = 1;
        e[j].f = 1;
        num++;
      } else
        v.push_back(j);
    }
    if (num != tot) {
      puts("-1");
      continue;
    }
    cnt = 0;
    memset(head, -1, sizeof(head));
    for (i = 0; i < m; i++)
      if (e[i].f) add(e[i].u, e[i].v, e[i].w, i);
    while (num < k) {
      memset(d, 0, sizeof(d));
      memset(b, 0, sizeof(b));
      dfs(1, 0);
      int mi = 1000000007, cur;
      for (i = 0; i < (int)v.size(); i++) {
        j = v[i];
        if (e[j].f) continue;
        if (mi > e[j].w - d[e[j].v]) {
          mi = e[j].w - d[e[j].v];
          cur = j;
        }
      }
      i = b[e[cur].v];
      g[i].f = 0;
      g[i ^ 1].f = 0;
      e[g[i].id].f = 0;
      e[cur].f = 1;
      add(1, e[cur].v, e[cur].w, cur);
      num++;
    }
    printf("%d\n", n - 1);
    for (i = 0; i < m; i++)
      if (e[i].f) printf("%d ", e[i].id);
    puts("");
  }
  return 0;
}