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 inf = 2000000000;
int n, m, cv, cd, x, y, z, h[5005], t[200005][4], w, d[5005], f[5005][2],
    mw[5005], out;
bool v[5005], flag;
void adde(int x, int y, int z, int id) {
  t[w][0] = y;
  t[w][1] = z;
  t[w][2] = h[x];
  t[w][3] = id;
  h[x] = w++;
}
struct node {
  int i, d;
  bool operator<(const node &t) const { return d > t.d; }
} temp;
priority_queue<node> q;
int mst(int mi, int mii, int miy) {
  int ret = 0;
  d[miy] = mi;
  f[miy][0] = cv;
  f[miy][1] = mii;
  temp.i = miy;
  temp.d = d[miy];
  q.push(temp);
  while (!q.empty()) {
    temp = q.top();
    q.pop();
    x = temp.i;
    if (v[x]) {
      v[x] = false;
      ret += temp.d;
      for (int i = h[x]; i != -1; i = t[i][2]) {
        y = t[i][0];
        if ((v[y]) && (t[i][1] < d[y])) {
          d[y] = t[i][1];
          f[y][0] = x;
          f[y][1] = i;
          temp.i = y;
          temp.d = d[y];
          q.push(temp);
        }
      }
    }
  }
  return ret;
}
int Q[5005], wQ;
void weight(int z) {
  if (z == cv) return;
  Q[wQ = 0] = z;
  while (mw[Q[wQ]] == -1) {
    Q[wQ + 1] = f[Q[wQ]][0];
    wQ++;
  }
  if (Q[wQ] == cv) mw[Q[--wQ]] = 0;
  for (int i = wQ - 1; i >= 0; i--)
    mw[Q[i]] = max(mw[Q[i + 1]], t[f[Q[i]][1]][1]);
}
int main() {
  scanf("%d%d%d", &n, &m, &cd);
  cv = 0;
  memset(h, -1, sizeof(h));
  w = 0;
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &x, &y, &z);
    x--;
    y--;
    adde(x, y, z, i + 1);
    adde(y, x, z, i + 1);
  }
  for (int i = 0; i < n; i++) d[i] = inf;
  d[cv] = 0;
  memset(f, -1, sizeof(f));
  f[cv][0] = cv;
  memset(v, true, sizeof(v));
  v[cv] = false;
  out = 0;
  while (1) {
    int mi = inf, mii, miy;
    for (int i = h[cv]; i != -1; i = t[i][2]) {
      y = t[i][0];
      if ((f[y][0] == -1) && (t[i][1] < mi)) {
        mi = t[i][1];
        mii = i;
        miy = t[i][0];
      }
    }
    if (mi == inf) break;
    cd--;
    out += mst(mi, mii, miy);
  }
  for (int i = 0; i < n; i++) {
    if (v[i]) {
      printf("-1\n");
      return 0;
    }
  }
  if (cd < 0) {
    printf("-1\n");
    return 0;
  }
  while (cd--) {
    memset(mw, -1, sizeof(mw));
    mw[cv] = 0;
    for (int i = 0; i < n; i++) weight(i);
    int mi = inf, mii, miy;
    for (int i = h[cv]; i != -1; i = t[i][2]) {
      y = t[i][0];
      if ((f[y][0] != cv) && (t[i][1] - mw[y] < mi)) {
        mi = t[i][1] - mw[y];
        mii = i;
        miy = t[i][0];
      }
    }
    if (mi == inf) {
      printf("-1\n");
      return 0;
    }
    out += mi;
    for (int i = miy, j = f[i][0], k = f[j][0], l = f[i][1];
         (t[l][1] != mw[miy]) && (k != cv); i = j, j = k, k = f[j][0]) {
      f[j][0] = i;
      swap(f[j][1], l);
      f[j][1] ^= 1;
    }
    f[miy][0] = cv;
    f[miy][1] = mii;
  }
  printf("%d\n", n - 1);
  flag = false;
  for (int i = 0; i < n; i++) {
    if (i != cv) {
      if (flag) printf(" ");
      flag = true;
      printf("%d", t[f[i][1]][3]);
    }
  }
  printf("\n");
  return 0;
}