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>
const int MaxN = 5e3 + 10, MaxM = 1e5 + 10, inf = 0x3f3f3f3f;
namespace IO {
char buf[1 << 15], *fs, *ft;
inline char getc() {
  return ft == fs && (ft = (fs = buf) + fread(buf, 1, 1 << 15, stdin), ft == fs)
             ? 0
             : *fs++;
}
template <typename T>
inline void read(T &x) {
  x = 0;
  T f = 1, ch = getchar();
  while (!isdigit(ch) && ch ^ '-') ch = getchar();
  if (ch == '-') f = -1, ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  x *= f;
}
template <typename T, typename... Args>
inline void read(T &x, Args &...args) {
  read(x);
  read(args...);
}
char Out[1 << 24], *fe = Out;
inline void flush() {
  fwrite(Out, 1, fe - Out, stdout);
  fe = Out;
}
template <typename T>
inline void write(T x, char str) {
  if (!x) *fe++ = 48;
  if (x < 0) *fe++ = '-', x = -x;
  T num = 0, ch[20];
  while (x) ch[++num] = x % 10 + 48, x /= 10;
  while (num) *fe++ = ch[num--];
  *fe++ = str;
}
}  // namespace IO
using IO::read;
using IO::write;
template <typename T>
inline bool chkMin(T &a, const T &b) {
  return a > b ? (a = b, true) : false;
}
template <typename T>
inline bool chkMax(T &a, const T &b) {
  return a < b ? (a = b, true) : false;
}
template <typename T>
inline T min(T a, T b) {
  return a < b ? a : b;
}
template <typename T>
inline T max(T a, T b) {
  return a > b ? a : b;
}
struct Orz {
  int x, y, z, id;
  inline Orz(int x = 0, int y = 0, int z = 0, int id = 0)
      : x(x), y(y), z(z), id(id) {}
  inline bool operator<(const Orz &a) const {
    return z < a.z || (z == a.z && x > a.x);
  }
} e[MaxN];
int n, m, K, tot, fa[MaxN];
inline int get(int x) { return fa[x] == x ? x : fa[x] = get(fa[x]); }
std::vector<int> g;
inline int Kruskal(int mid) {
  for (int i = 1; i <= m; ++i)
    if (e[i].x == 1) e[i].z += mid;
  for (int i = 1; i <= n; ++i) fa[i] = i;
  int cnt = 0;
  g.clear();
  std::sort(e + 1, e + m + 1);
  for (int i = 1; i <= m; ++i) {
    int x = get(e[i].x), y = get(e[i].y);
    if (x == y) continue;
    fa[x] = y, g.push_back(e[i].id);
    if (e[i].x == 1) ++cnt;
  }
  for (int i = 1; i <= m; ++i)
    if (e[i].x == 1) e[i].z -= mid;
  return cnt;
}
inline void Clac(int mid) {
  for (int i = 1; i <= m; ++i)
    if (e[i].x == 1) e[i].z += mid;
  for (int i = 1; i <= n; ++i) fa[i] = i;
  int cnt = 0, tot = 0;
  g.clear();
  std::sort(e + 1, e + m + 1);
  for (int i = 1; i <= m; ++i) {
    int x = get(e[i].x), y = get(e[i].y);
    if (x == y) continue;
    if (e[i].x == 1 && cnt == K) continue;
    fa[x] = y, g.push_back(e[i].id);
    if (e[i].x == 1) ++cnt;
    ++tot;
  }
  if (cnt < K || tot != n - 1) {
    puts("-1");
    exit(0);
  }
}
int main() {
  read(n, m, K);
  for (int i = 1, x, y, z; i <= m; ++i) {
    read(x, y, z);
    if (x > y) std::swap(x, y);
    if (x == 1) ++tot;
    e[i] = Orz(x, y, z, i);
  }
  int l = -1e5, r = 1e5, ans = -inf;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (Kruskal(mid) < K)
      r = mid - 1;
    else
      l = mid + 1, ans = mid;
  }
  if (ans < -1e5)
    write(-1, '\n');
  else {
    Clac(r);
    write(n - 1, '\n');
    for (int i = 0; i < n - 1; ++i) write(g[i], ' ');
  }
  IO::flush();
  return 0;
}