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 dataStruct {
  int x, y, w, d;
};
int nArray[5010];
bool boolArray[100010];
dataStruct g[2][100010];
void swap(dataStruct &str1, dataStruct &str2) {
  dataStruct tmp = str1;
  str1 = str2;
  str2 = tmp;
}
int getfather(int x) {
  if (nArray[x] != x) nArray[x] = getfather(nArray[x]);
  return nArray[x];
}
void fin(int l, int r, int d) {
  int i = l, j = r;
  dataStruct mid = g[d][(l + r) / 2];
  while (i <= j) {
    while (g[d][i].w < mid.w || (g[d][i].w == mid.w && g[d][i].d < mid.d)) i++;
    while (g[d][j].w > mid.w || (g[d][j].w == mid.w && g[d][j].d > mid.d)) j--;
    if (i <= j) {
      swap(g[d][i], g[d][j]);
      i++;
      j--;
    }
  }
  if (i < r) fin(i, r, d);
  if (l < j) fin(l, j, d);
}
bool check1(int k, int &m1, int &m2, int &n) {
  int x, y, i;
  if (m1 < k) return false;
  for (i = 1; i <= n; i++) nArray[i] = i;
  for (i = 1; i <= m2; i++) {
    x = getfather(g[1][i].x);
    y = getfather(g[1][i].y);
    if (x != y)
      if (x < y)
        nArray[y] = x;
      else
        nArray[x] = y;
  }
  memset(boolArray, false, sizeof(boolArray));
  x = 0;
  for (i = 2; i <= n; i++) {
    y = getfather(i);
    if (!boolArray[y]) {
      x++;
      boolArray[y] = true;
    }
  }
  if (x > k) return false;
  for (i = 1; i <= m1; i++) {
    x = getfather(g[0][i].x);
    y = getfather(g[0][i].y);
    if (x != y) {
      if (x < y)
        nArray[y] = x;
      else
        nArray[x] = y;
    }
  }
  for (i = 1; i <= n; i++) {
    if (getfather(i) != 1) return false;
    return true;
  }
}
int check2(double delta, int k, int &n, int &m1, int &m2) {
  int i, j, s = 0, x, y, sum = 0;
  dataStruct t;
  bool c;
  for (i = 1; i <= n; i++) nArray[i] = i;
  memset(boolArray, false, sizeof(boolArray));
  i = 1;
  j = 1;
  while (s < n - 1) {
    if (i <= m1 && (g[0][i].w + delta < g[1][j].w ||
                    (g[0][i].w + delta <= g[1][j].w && sum < k) || j > m2)) {
      t = g[0][i];
      i++;
      c = true;
    } else {
      t = g[1][j];
      j++;
      c = false;
    }
    x = getfather(t.x);
    y = getfather(t.y);
    if (x != y) {
      nArray[y] = x;
      s++;
      if (c) sum++;
      boolArray[t.d] = true;
    }
  }
  return (sum);
}
int main() {
  int m, k, i, x, y, w, n, m1 = 0, m2 = 0;
  double l, r, mid;
  cin >> n >> m >> k;
  for (i = 1; i <= m; i++) {
    cin >> x >> y >> w;
    if (x == 1 || y == 1) {
      m1++;
      g[0][m1].x = x;
      g[0][m1].y = y;
      g[0][m1].w = w;
      g[0][m1].d = i;
    } else {
      m2++;
      g[1][m2].x = x;
      g[1][m2].y = y;
      g[1][m2].w = w;
      g[1][m2].d = i;
    }
  }
  if (!check1(k, m1, m2, n)) {
    cout << "-1";
    return 0;
  }
  fin(1, m1, 0);
  fin(1, m2, 1);
  l = -100000;
  r = 100000;
  while (true) {
    mid = (l + r) / 2;
    int temp = check2(mid, k, n, m1, m2);
    if (temp == k) {
      cout << n - 1 << endl;
      for (i = 1; i <= m; i++) {
        if (boolArray[i]) cout << i << " ";
      }
      return 0;
    } else if (temp < k)
      r = mid;
    else
      l = mid;
  }
  cout << "-1";
  return 0;
}