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;
class DisjointSet {
  int N;
  int ncomp;
  vector<int> par;
  vector<int> rank;

 public:
  DisjointSet(size_t _N) : N(_N), ncomp(_N), par(_N, -1), rank(_N, 0) {}
  void reset() {
    par.assign(N, -1);
    rank.assign(N, 0);
    ncomp = N;
  }
  int size() const { return ncomp; }
  int find_rep(int u) { return par[u] < 0 ? u : par[u] = find_rep(par[u]); }
  bool union_rep(int u, int v) {
    int u_root = find_rep(u);
    int v_root = find_rep(v);
    if (u_root == v_root) return false;
    if (rank[u_root] > rank[v_root])
      par[v_root] = u_root;
    else {
      par[u_root] = v_root;
      if (rank[u_root] == rank[v_root]) rank[v_root] = rank[u_root] + 1;
    }
    --ncomp;
    return true;
  }
};
struct Edge {
  int id;
  int u, v;
  double weight;
  Edge(int _id, int _u, int _v, double _weight)
      : id(_id), u(_u), v(_v), weight(_weight) {}
};
const double EPS = 1e-9;
class CostCmp {
 public:
  bool operator()(const Edge& e1, const Edge& e2) {
    if (fabs(e1.weight - e2.weight) > EPS) return e1.weight < e2.weight;
    return e1.id < e2.id;
  }
};
bool trace;
vector<bool> in_mst;
int F(int N, const vector<Edge>& edges, double delta) {
  vector<Edge> tedges = edges;
  for (Edge& e : tedges) {
    if (e.u == 0 || e.v == 0) e.weight += delta;
  }
  in_mst.assign(edges.size(), false);
  sort(tedges.begin(), tedges.end(), CostCmp());
  int k = 0;
  DisjointSet dset(N);
  for (Edge e : tedges) {
    if (int((dset).size()) == 1) break;
    bool f = dset.union_rep(e.u, e.v);
    if (trace) {
      cerr << fixed << setprecision(12) << "* [" << e.id + 1 << "] "
           << "(" << e.u + 1 << "," << e.v + 1 << ") " << e.weight << " --> "
           << f << endl;
    }
    if (f) {
      in_mst[e.id] = true;
      if (e.u == 0 || e.v == 0) ++k;
    }
  }
  return k;
}
int N, M, K;
vector<Edge> edges;
void solve() {
  if (K == 0) {
    int res = N == 1 ? 0 : -1;
    cout << res << '\n';
    return;
  }
  int k = 0;
  for (Edge& e : edges) {
    if (e.u == 0 || e.v == 0) {
      ++k;
    }
  }
  if (k < K) {
    cout << "-1\n";
    return;
  }
  double lo = -10000000.0, hi = 10000000.0;
  for (int t = (1), _b = (100); t <= _b; ++t) {
    double mid = (lo + hi) / 2;
    int k = F(N, edges, mid);
    cerr << fixed << setprecision(12) << "lo:" << lo << "  hi:" << hi
         << "  mid:" << mid << "  k:" << k << endl;
    if (k >= K) {
      lo = mid;
    } else {
      hi = mid;
    }
  }
  cerr << "lo"
       << ": " << lo << endl;
  cout << N - 1 << '\n';
  k = F(N, edges, lo);
  for (Edge e : edges)
    if (in_mst[e.id]) cout << e.id + 1 << ' ';
  cout << endl;
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> M >> K;
  for (int m = 0, _n = (M); m < _n; ++m) {
    int u, v, weight;
    cin >> u >> v >> weight;
    --u, --v;
    edges.emplace_back(m, u, v, weight);
  }
  solve();
  return 0;
}