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;
template <typename T>
inline T read() {
  T sum = 0, fl = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fl = -1;
  for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
  return sum * fl;
}
const int maxn = 5000 + 5;
const int maxm = 1e5 + 5;
int n, m, k, c;
long long mx[maxn];
bool del[maxm << 1], no[maxm];
int fa[maxn], id[maxm << 1];
vector<int> vec, E;
int he[maxn], ne[maxm << 1], to[maxm << 1], w[maxm << 1];
struct EDGE {
  int u, v, w, id;
} e[maxm];
bool operator<(const EDGE& a, const EDGE& b) { return a.w < b.w; }
void add_edge(int u, int v, int val) {
  ne[++c] = he[u];
  he[u] = c;
  to[c] = v;
  w[c] = val;
  ne[++c] = he[v];
  he[v] = c;
  to[c] = u;
  w[c] = val;
}
int find(int first) {
  return fa[first] == first ? first : fa[first] = find(fa[first]);
}
void forest() {
  for (int i = 1; i <= n; ++i) fa[i] = i;
  sort(e + 1, e + m + 1);
  for (int i = 1; i <= m; ++i) {
    int u = find(e[i].u), v = find(e[i].v);
    if (u == v || u == 1 || v == 1) continue;
    fa[u] = v;
    E.push_back(e[i].id);
    add_edge(e[i].u, e[i].v, e[i].w);
    id[c] = id[c - 1] = e[i].id;
  }
}
void get_max(int p, int f) {
  for (int i = he[p]; i; i = ne[i]) {
    if (to[i] == f || del[i] || to[i] == 1) continue;
    if (w[i] >= w[mx[p]])
      mx[to[i]] = i;
    else
      mx[to[i]] = mx[p];
    get_max(to[i], p);
  }
}
void Solve() {
  n = read<int>(), m = read<int>(), k = read<int>();
  c = 1;
  for (int i = 1; i <= m; ++i)
    e[i] = (EDGE){read<int>(), read<int>(), read<int>(), i};
  forest();
  for (int i = 1; i <= m; ++i) {
    if (e[i].u != 1 && e[i].v != 1) continue;
    int u = find(e[i].u), v = find(e[i].v);
    if (u == v)
      vec.push_back(i);
    else
      fa[u] = v, add_edge(e[i].u, e[i].v, e[i].w), E.push_back(e[i].id), --k;
  }
  for (int i = 2; i <= n; ++i)
    if (find(i) != find(i - 1)) return (void)printf("-1");
  if (k < 0) return (void)printf("-1");
  for (int i = 1; i <= k; ++i) {
    if (!vec.size()) return (void)printf("-1");
    memset(mx, 0, sizeof(mx));
    for (int j = he[1]; j; j = ne[j]) get_max(to[j], 1);
    int now = -1, ans = 2147483647;
    for (int j = vec.size() - 1; j >= 0; --j) {
      int p = vec[j], var = max(e[p].u, e[p].v);
      if (e[p].w - w[mx[var]] < ans) ans = e[p].w - w[mx[var]], now = j;
    }
    int p = vec[now], var = e[p].u == 1 ? e[p].v : e[p].u;
    add_edge(e[p].v, e[p].u, e[p].w);
    E.push_back(e[p].id);
    no[id[mx[var]]] = 1;
    del[mx[var]] = del[mx[var] ^ 1] = 1;
    vec.erase(vec.begin() + now);
  }
  printf("%d\n", n - 1);
  for (int i = E.size() - 1; i >= 0; --i)
    if (!no[E[i]]) printf("%d ", E[i]);
}
int main() {
  Solve();
  return 0;
}