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 maxn = 100008, maxm = 200008;
struct Tedge {
  int start[maxn], tot;
  struct arr {
    int a, next, c, i;
  } e[maxn << 2];
  void clear() {
    tot = 1;
    memset(start, 0, sizeof(start));
  }
  void add(int x, int y, int c, int i) {
    e[++tot].a = y;
    e[tot].next = start[x];
    start[x] = tot;
    e[tot].c = c;
    e[tot].i = i;
    e[++tot].a = x;
    e[tot].next = start[y];
    start[y] = tot;
    e[tot].c = c;
    e[tot].i = i;
  }
} E;
int flag[maxn], flag1[maxm], value[maxn], fa[maxn];
int t[maxm], in[maxm];
int K, n, m;
struct arr {
  int x, y, c, i;
  bool operator<(const arr &t) const { return c < t.c; }
} p[maxm], e[maxm];
int tot, E_tot;
vector<int> ans;
struct Tprogram {
  void open() {
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
  }
  void close() {}
  void dfs(int u) {
    flag[u] = 1;
    for (int i = E.start[u], v; v = E.e[i].a, i; i = E.e[i].next)
      if (!flag[v]) {
        value[v] = E.e[i].c > E.e[value[u]].c ? i : value[u];
        dfs(v);
      }
  }
  void dfs1(int u) {
    flag[u] = 1;
    for (int i = E.start[u], v; v = E.e[i].a, i; i = E.e[i].next)
      if (!flag[v] && !flag1[i]) {
        value[v] = E.e[i].c > E.e[value[u]].c ? i : value[u];
        dfs1(v);
      }
    flag[u] = 0;
  }
  int find(int i) {
    if (i == fa[i]) return i;
    return fa[i] = find(fa[i]);
  }
  void init() {
    scanf("%d%d%d", &n, &m, &K);
    int u, v, w;
    E.clear();
    for (int i = 1; i <= m; i++) {
      scanf("%d%d%d", &u, &v, &w);
      if (u > v) swap(u, v);
      if (u == 1)
        p[++tot].x = v, p[tot].c = w, p[tot].i = i;
      else
        e[++E_tot].x = u, e[E_tot].y = v, e[E_tot].c = w, e[E_tot].i = i;
    }
    sort(e + 1, e + E_tot + 1);
    for (int i = 1; i <= n; i++) fa[i] = i;
    for (int i = 1; i <= E_tot; i++) {
      int x = e[i].x, y = e[i].y, w = e[i].c;
      int f1 = find(x), f2 = find(y);
      if (f1 != f2) {
        E.add(x, y, w, e[i].i);
        ans.push_back(e[i].i);
        fa[f1] = f2;
      }
    }
    sort(p + 1, p + tot + 1);
    for (int i = 1; i <= tot; i++)
      if (!flag[p[i].x]) {
        value[p[i].x] = 0;
        dfs(p[i].x);
        ans.push_back(p[i].i);
        in[i] = 1;
        K--;
      }
  }
  void work() {
    for (int i = 2; i <= n; i++)
      if (!flag[i]) return printf("-1\n"), void();
    if (K < 0) return printf("-1\n"), void();
    memset(flag, 0, sizeof(flag));
    while (K--) {
      int pt = 0, v = 1e9;
      for (int i = 1; i <= tot; i++)
        if (!in[i]) {
          if (p[i].c - E.e[value[p[i].x]].c < v) {
            v = p[i].c - E.e[value[p[i].x]].c;
            pt = i;
          }
        }
      if (pt == 0) return printf("-1\n"), void();
      ans.push_back(p[pt].i);
      int j = value[p[pt].x];
      flag1[j] = flag1[j ^ 1] = 1;
      t[E.e[j].i] = 1;
      in[pt] = 1;
      value[p[pt].x] = 0;
      dfs1(p[pt].x);
    }
    printf("%d\n", n - 1);
    for (int i = 0; i <= (int)ans.size() - 1; i++)
      if (!t[ans[i]]) printf("%d ", ans[i]);
  }
} Program;
int main() {
  Program.init();
  Program.work();
  return 0;
}