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>
#pragma GCC optimize(2)
using namespace std;
const int maxn = 5e3;
const int maxm = 1e5;
const int INF = 0x7fffffff;
const int mod = 1e9 + 7;
const double eps = 1e-7;
const double Pi = acos(-1.0);
inline int read_int() {
  char c;
  int ret = 0, sgn = 1;
  do {
    c = getchar();
  } while ((c < '0' || c > '9') && c != '-');
  if (c == '-')
    sgn = -1;
  else
    ret = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  return sgn * ret;
}
inline long long read_ll() {
  char c;
  long long ret = 0, sgn = 1;
  do {
    c = getchar();
  } while ((c < '0' || c > '9') && c != '-');
  if (c == '-')
    sgn = -1;
  else
    ret = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  return sgn * ret;
}
inline long long quick_pow(long long base, long long index, long long p) {
  long long res = 1;
  while (index) {
    if (index & 1) res = res * base % p;
    base = base * base % p;
    index >>= 1;
  }
  return res;
}
struct edge {
  bool operator<(const edge& rhs) const {
    return w == rhs.w ? u < rhs.u : w < rhs.w;
  }
  edge() {}
  edge(int _u, int _v, int _w, int _id) { u = _u, v = _v, w = _w, id = _id; }
  int u, v, w, id;
} e[maxm + 5], tmp[maxm + 5];
int n, m, k, cnt;
int ufs[maxn + 5];
int find(int x) { return x == ufs[x] ? x : ufs[x] = find(ufs[x]); }
bool unite(int x, int y) {
  x = find(x), y = find(y);
  if (x == y) return false;
  ufs[x] = y;
  return true;
}
int cntk, l, r, ans;
bool solve(int mid) {
  for (int i = 1; i <= m; ++i) {
    tmp[i] = e[i];
    if (e[i].u == 1) tmp[i].w -= mid;
  }
  for (int i = 1; i <= m; ++i) {
  }
  sort(tmp + 1, tmp + 1 + m);
  cntk = 0;
  for (int i = 1; i <= n; ++i) ufs[i] = i;
  for (int i = 1; i <= m; ++i) {
    if (unite(tmp[i].u, tmp[i].v)) {
      if (tmp[i].u == 1) ++cntk;
    }
  }
  return cntk >= k;
}
vector<int> vecres;
int main() {
  n = read_int(), m = read_int(), k = read_int();
  for (int i = 1, u, v, w; i <= m; ++i) {
    u = read_int(), v = read_int(), w = read_int();
    if (u > v) swap(u, v);
    e[i] = edge(u, v, w, i);
    if (u == 1) ++cnt;
  }
  if ((n > 1 && k == 0) || cnt < k) {
    printf("%d\n", -1);
    return 0;
  }
  l = -1e5, r = 1e5;
  while (l <= r) {
    int mid = l + r >> 1;
    if (solve(mid)) {
      r = mid - 1;
      if (cntk >= k) ans = mid;
    } else
      l = mid + 1;
  }
  for (int i = 1; i <= m; ++i) {
    tmp[i] = e[i];
    if (e[i].u == 1) tmp[i].w -= ans;
  }
  sort(tmp + 1, tmp + 1 + m);
  cntk = 0;
  for (int i = 1; i <= n; ++i) ufs[i] = i;
  for (int i = 1; i <= m; ++i) {
    int x = find(tmp[i].u), y = find(tmp[i].v);
    if (x == y) continue;
    if (cntk == k && tmp[i].u == 1) continue;
    vecres.push_back(tmp[i].id);
    ufs[x] = y;
    if (tmp[i].u == 1) ++cntk;
  }
  if (vecres.size() != n - 1) {
    printf("%d\n", -1);
    return 0;
  }
  printf("%d\n", n - 1);
  for (int i = 0; i < vecres.size(); ++i)
    printf("%d%c", vecres[i], " \n"[i + 1 == vecres.size()]);
  return 0;
}