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 p[5500];
int h[5500];
int n, m;
int k;
int root(int v) {
  if (v == p[v]) return v;
  return p[v] = root(p[v]);
}
void unite(int u, int v) {
  u = root(u);
  v = root(v);
  if (u == v) return;
  if (u != v) {
    if (h[u] < h[v])
      p[u] = v;
    else if (h[u] > h[v])
      p[v] = u;
    else {
      p[u] = v;
      ++h[v];
    }
  }
}
const double eps = 1e-7;
struct Edge {
  int u, v;
  int ind;
  double w;
  bool operator<(const Edge& e) const { return w < e.w; }
};
template <typename T>
void merge(const vector<T>& a, const vector<T>& b, vector<T>& c) {
  c.resize(0);
  int i = 0, j = 0;
  while (i < a.size() && j < b.size()) {
    if (a[i] < b[j]) {
      c.push_back(a[i]);
      ++i;
    } else {
      c.push_back(b[j]);
      ++j;
    }
  }
  for (; i < a.size(); ++i) c.push_back(a[i]);
  for (; j < b.size(); ++j) c.push_back(b[j]);
}
vector<Edge> e;
vector<Edge> e1, e2;
void precalc() {
  for (int i = 0; i < e.size(); ++i) {
    if (e[i].u == 0 || e[i].v == 0) {
      e1.push_back(e[i]);
    } else
      e2.push_back(e[i]);
  }
  sort(e2.begin(), e2.end());
  sort(e1.begin(), e1.end());
}
int test(double x) {
  vector<Edge> e3;
  for (int i = 0; i < e1.size(); ++i) {
    e3.push_back(e1[i]);
    e3[i].w += x;
  }
  merge(e2, e3, e);
  for (int i = 0; i < n; ++i) {
    h[i] = 1;
    p[i] = i;
  }
  int ret = 0;
  for (int i = 0; i < e.size(); ++i) {
    int u = e[i].u;
    int v = e[i].v;
    u = root(u);
    v = root(v);
    if (u != v) {
      e[i].ind = -e[i].ind;
      if (e[i].u == 0 || e[i].v == 0) ++ret;
      unite(u, v);
    }
  }
  return ret;
}
void solve() {
  precalc();
  for (int i = 0; i < e1.size(); ++i) {
    e1[i].w += eps * i;
  }
  double l = -10000000;
  double r = 10000000;
  while (l + eps < r) {
    double m = (l + r) / 2;
    if (test(m) > k)
      l = m;
    else
      r = m;
  }
  if (test(l) != k) test(r);
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  if (k == 0) {
    if (n > 1)
      printf("-1");
    else
      printf("0");
    return 0;
  }
  for (int i = 0; i < m; ++i) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    --u;
    --v;
    Edge ed;
    ed.u = u;
    ed.v = v;
    ed.ind = i + 1;
    ed.w = w;
    e.push_back(ed);
  }
  solve();
  printf("%d\n", n - 1);
  for (int i = 0; i < e.size(); ++i)
    if (e[i].ind < 0) {
      printf("%d ", -e[i].ind);
    }
  return 0;
}