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;
int n, m, k;
struct node {
  int u, v, val, id;
  node() {}
  node(int u1, int v1, int id1, int val1) : u(u1), v(v1), id(id1), val(val1) {}
  bool operator<(const node &a) const {
    if (val != a.val) return val < a.val;
    return u < a.u;
  }
} l[100010];
vector<node> spe, del;
vector<int> id;
vector<int> a[100010], idx[100010];
int sum, ans, fa[100010], fav[100010];
bool used[100010];
int get_fa(int x) {
  if (fa[x] == 0) return x;
  fa[x] = get_fa(fa[x]);
  return fa[x];
}
void dfs(int x, int f, int id) {
  if (f != 1 && f != 0) {
    if (del[fav[f]].val > del[id].val)
      fav[x] = fav[f];
    else
      fav[x] = id;
  }
  for (int i = 0; i < a[x].size(); i++) {
    if (a[x][i] == f) continue;
    dfs(a[x][i], x, idx[x][i]);
  }
}
void build() {
  memset(a, 0, sizeof a);
  memset(idx, 0, sizeof idx);
  memset(fav, 0, sizeof fav);
  for (int i = 0; i < del.size(); i++)
    if (used[i] == 1) {
      int u = del[i].u, v = del[i].v, val = del[i].val;
      a[u].push_back(v);
      a[v].push_back(u);
      idx[u].push_back(i);
      idx[v].push_back(i);
    }
  dfs(1, 0, 0);
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  int u, v, val;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &u, &v, &val);
    l[i] = node(u, v, i, val);
  }
  sort(l + 1, l + 1 + m);
  for (int i = 1; i <= m; i++) {
    int u = l[i].u, v = l[i].v, val = l[i].val;
    if (u == 1 || v == 1) continue;
    int fu = get_fa(u);
    int fv = get_fa(v);
    if (fu != fv) {
      fa[fu] = fv;
      sum += val;
      del.push_back(l[i]);
      used[del.size() - 1] = 1;
    }
  }
  for (int i = 1; i <= m; i++) {
    int u = l[i].u, v = l[i].v, val = l[i].val;
    if (u != 1 && v != 1) continue;
    if (v == 1) swap(u, v);
    del.push_back(l[i]);
    spe.push_back(l[i]);
    id.push_back(del.size() - 1);
    int fu = get_fa(u);
    int fv = get_fa(v);
    if (fu != fv) {
      fa[fu] = fv;
      sum += val;
      used[del.size() - 1] = 1;
      k--;
    }
  }
  ans = sum;
  while (k > 0) {
    build();
    int add = -1, maxd, delx;
    for (int i = 0; i < spe.size(); i++) {
      if (used[id[i]] == 1) continue;
      int u = spe[i].u, v = spe[i].v, val = spe[i].val;
      if (v == 1) swap(u, v);
      int maxv = del[fav[v]].val;
      if (add == -1 || maxd < maxv - val) {
        add = id[i];
        delx = fav[v];
        maxd = maxv - val;
      }
    }
    if (add == -1) break;
    used[add] = 1;
    used[delx] = 0;
    sum -= maxd;
    ans = min(ans, sum);
    k--;
  }
  if (k != 0) {
    printf("-1");
    return 0;
  }
  printf("%d\n", n - 1);
  for (int i = 0; i < del.size(); i++)
    if (used[i] == 1) {
      printf("%d ", del[i].id);
    }
}