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;
inline bool SR(int &x) { return scanf("%d", &x) == 1; }
inline bool SR(long long &x) { return scanf("%lld", &x) == 1; }
inline bool SR(double &x) { return scanf("%lf", &x); }
inline bool SR(char *s) { return scanf("%s", s); }
inline bool RI() { return 1; }
template <typename I, typename... T>
bool RI(I &x, T &...tail) {
  return SR(x) && RI(tail...);
}
inline void SP(const int x) { printf("%d", x); }
inline void SP(const long long x) { printf("%lld", x); }
inline void SP(const double x) { printf("%.10f", x); }
inline void SP(const char *s) { printf("%s", s); }
inline void PL() { puts(""); }
template <typename I, typename... T>
void PL(const I x, const T... tail) {
  SP(x);
  if (sizeof...(tail)) putchar(' ');
  PL(tail...);
}
template <typename I>
inline void _DOING(const char *s, I &&x) {
  cerr << s << " = " << x << '\n';
}
template <typename I, typename... T>
void _DOING(const char *s, I &&x, T &&...tail) {
  int c = 0;
  while (*s != ',' || c != 0) {
    if (*s == '(' || *s == '[' || *s == '{') c++;
    if (*s == ')' || *s == ']' || *s == '}') c--;
    cerr << *s++;
  }
  cerr << " = " << x << " , ";
  _DOING(s + 1, tail...);
}
const int INF = 0x3f3f3f3f;
const long long INF64 = 0x3f3f3f3f3f3f3f3fll;
inline int RAND() {
  static int x = 880301;
  return x = (x * 0xdefacedll + 1ll) % 0x7fffffffll;
}
const int MAX_N = 5000 + 7;
struct Dsu {
  int par[MAX_N], sz[MAX_N], cc_cnt;
  void init(int n) {
    for (int i = 0; i < int(n); i++) {
      par[i] = i;
      sz[i] = 1;
    }
    cc_cnt = n;
  }
  int find(int x) {
    if (x == par[x])
      return x;
    else
      return par[x] = find(par[x]);
  }
  bool merge(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return 0;
    cc_cnt--;
    if (sz[x] < sz[y]) swap(x, y);
    sz[x] += sz[y];
    par[y] = x;
    return 1;
  }
  bool query(int x, int y) { return find(x) == find(y); }
} dsu;
struct Edge {
  int id, u, v, w;
  Edge() {}
  Edge(int _id, int _u, int _v, int _w) : id(_id), u(_u), v(_v), w(_w) {}
};
int N, M, K;
vector<Edge> edges;
inline int calc(long double x) {
  sort((edges).begin(), (edges).end(), [&](const Edge &a, const Edge &b) {
    bool flag1 = 0, flag2 = 0;
    if (a.u == 0 || a.v == 0) flag1 = 1;
    if (b.u == 0 || b.v == 0) flag2 = 1;
    if (flag1) {
      if (flag2)
        return a.w < b.w;
      else
        return a.w + x < b.w;
    } else {
      if (flag2)
        return a.w < b.w + x;
      else
        return a.w < b.w;
    }
  });
  int res = 0;
  dsu.init(N);
  for (Edge &e : edges) {
    if (dsu.query(e.u, e.v)) continue;
    if (e.u == 0 || e.v == 0) res++;
    dsu.merge(e.u, e.v);
  }
  return res;
}
int main() {
  RI(N, M, K);
  dsu.init(N);
  int deg = 0;
  for (int i = 0; i < int(M); i++) {
    int u, v, w;
    RI(u, v, w);
    u--, v--;
    if (u > v) swap(u, v);
    if (u == 0) deg++;
    dsu.merge(u, v);
    edges.push_back(Edge(i, u, v, w));
  }
  if (dsu.cc_cnt != 1 || deg < K) {
    PL(-1);
    return 0;
  }
  long double lb = -2e5;
  long double rb = 2e5;
  long double mid = 0;
  for (int times = 0; times < int(500); times++) {
    mid = (lb + rb) / 2.0;
    int t = calc(mid);
    if (t == K)
      break;
    else if (t < K)
      rb = mid;
    else
      lb = mid;
  }
  calc(mid);
  int cnt = 0;
  vector<int> ans;
  dsu.init(N);
  for (Edge &e : edges) {
    if (dsu.query(e.u, e.v)) continue;
    if (e.u == 0 || e.v == 0) {
      if (cnt == K)
        continue;
      else
        cnt++;
    }
    dsu.merge(e.u, e.v);
    ans.push_back(e.id);
  }
  if (((int)ans.size()) != N - 1) {
    PL(-1);
    return 0;
  }
  PL(((int)ans.size()));
  for (int i = 0; i < int(((int)ans.size())); i++)
    printf("%d%c", ans[i] + 1, " \n"[i == ((int)ans.size()) - 1]);
  return 0;
}