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 d, i;
  bool operator<(const node &t) const { return d > t.d; }
} temp;
priority_queue<node> pq;
int d[5002];
bool v[5002];
void dfs(int x, int w, int h[], int t[][3], int S, int f[][2]) {
  d[x] = w;
  for (int i = h[x]; i != -1; i = t[i][2]) {
    int y = t[i][0], z = t[i][1];
    if (f[y][0] == x) dfs(y, (x == S) ? w : max(w, z), h, t, S, f);
  }
}
int DCMST(int n, int h[], int t[][3], int S, int L, int H, int f[][2]) {
  for (int i = 0; i < n; ++i) d[i] = (i == S) ? 0 : 1000000000;
  f[S][0] = f[S][1] = -1;
  memset(v, true, sizeof(v));
  v[S] = false;
  int cnt = 0, ret = 0;
  while (1) {
    int mi = 1000000000, mii = -1, miy = -1;
    for (int i = h[S]; i != -1; i = t[i][2]) {
      int y = t[i][0], z = t[i][1];
      if (v[y] && z < mi) {
        mi = z;
        mii = i;
        miy = y;
      }
    }
    if (mi == 1000000000) break;
    if ((++cnt) > H) return -1;
    d[miy] = mi;
    f[miy][0] = S;
    f[miy][1] = mii;
    temp.d = mi;
    temp.i = miy;
    pq.push(temp);
    while (!pq.empty()) {
      temp = pq.top();
      pq.pop();
      int x = temp.i;
      if (v[x]) {
        v[x] = false;
        ret += temp.d;
        for (int i = h[x]; i != -1; i = t[i][2]) {
          int y = t[i][0], z = t[i][1];
          if (v[y] && z < d[y]) {
            d[y] = z;
            f[y][0] = x;
            f[y][1] = i;
            temp.i = y;
            temp.d = d[y];
            pq.push(temp);
          }
        }
      }
    }
  }
  for (int i = 0; i < n; ++i)
    if (v[i]) return -1;
  dfs(S, 0, h, t, S, f);
  while (cnt < H) {
    int mi = 1000000000, mii = -1, miy = -1;
    for (int i = h[S]; i != -1; i = t[i][2]) {
      int y = t[i][0], z = t[i][1] - d[y];
      if (f[y][0] != S && z < mi) {
        mi = z;
        mii = i;
        miy = y;
      }
    }
    if (mi == 1000000000) return (L <= cnt) ? ret : -1;
    if (mi >= 0 && L <= cnt) return ret;
    cnt++;
    ret += mi;
    for (int i = miy, j = f[i][0], k = f[j][0], l = f[i][1];
         t[l][1] != d[miy] && k != S; i = j, j = k, k = f[j][0]) {
      f[j][0] = i;
      swap(f[j][1], l);
      f[j][1] ^= 1;
    }
    f[miy][0] = S;
    f[miy][1] = mii;
    dfs(miy, 0, h, t, S, f);
  }
  return ret;
}
int n, m, k, x, y, z, h[5002], t[200002][3], w, f[5002][2];
void adde(int x, int y, int z) {
  t[w][0] = y;
  t[w][1] = z;
  t[w][2] = h[x];
  h[x] = w++;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  memset(h, -1, sizeof(h));
  w = 0;
  while (m--) {
    scanf("%d%d%d", &x, &y, &z);
    x--;
    y--;
    adde(x, y, z);
    adde(y, x, z);
  }
  if (DCMST(n, h, t, 0, k, k, f) == -1)
    printf("-1\n");
  else {
    printf("%d\n", n - 1);
    for (int i = 1; i < n; ++i) {
      if (i != 1) printf(" ");
      printf("%d", (f[i][1] >> 1) + 1);
    }
    printf("\n");
  }
  return 0;
}