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;
const int Maxn = 5005;
const int Maxm = 100005;
const int Maxw = 100005;
int n, m, k;
int a[Maxm], b[Maxm];
vector<pair<int, int> > S, C;
vector<bool> mC;
int c, p[Maxn], siz[Maxn];
vector<int> res;
void initSet() {
  for (int i = 1; i <= n; i++) p[i] = i, siz[i] = 1;
  c = n;
}
int getPar(int x) { return p[x] == x ? x : p[x] = getPar(p[x]); }
void unionSet(int a, int b) {
  int para = getPar(a), parb = getPar(b);
  if (siz[para] >= siz[parb]) {
    siz[para] += siz[parb];
    p[parb] = para;
  } else {
    siz[parb] += siz[para];
    p[para] = parb;
  }
  c--;
}
int Take(int dif) {
  int res = 0;
  initSet();
  int i = 0, j = 0;
  while (i < C.size() || j < S.size())
    if (i < C.size() && (j == S.size() || C[i].first + dif <= S[j].first)) {
      int ind = C[i].second;
      i++;
      if (getPar(a[ind]) != getPar(b[ind])) {
        res++;
        unionSet(a[ind], b[ind]);
      }
    } else {
      int ind = S[j].second;
      j++;
      if (getPar(a[ind]) != getPar(b[ind])) unionSet(a[ind], b[ind]);
    }
  return c > 1 ? -Maxw - 1 : res;
}
void Collect(int dif) {
  initSet();
  int i = 0, j = 0;
  while (i < C.size() || j < S.size())
    if (i < C.size() && (j == S.size() || C[i].first + dif <= S[j].first)) {
      int ind = C[i].second;
      i++;
      if (getPar(a[ind]) != getPar(b[ind]) && k) {
        k--;
        unionSet(a[ind], b[ind]);
        res.push_back(ind);
      }
    } else {
      int ind = S[j].second;
      j++;
      if (getPar(a[ind]) != getPar(b[ind])) {
        unionSet(a[ind], b[ind]);
        res.push_back(ind);
      }
    }
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= m; i++) {
    int c;
    scanf("%d %d %d", &a[i], &b[i], &c);
    if (a[i] == 1 || b[i] == 1) {
      C.push_back(pair<int, int>(c, i));
      mC.push_back(false);
    } else
      S.push_back(pair<int, int>(c, i));
  }
  sort(C.begin(), C.end());
  sort(S.begin(), S.end());
  int l = -Maxw, r = Maxw;
  int dif = -Maxw - 1;
  while (l <= r) {
    int mid = l + r >> 1;
    if (Take(mid) >= k) {
      dif = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  if (dif < -Maxw) {
    printf("-1\n");
    return 0;
  }
  Collect(dif);
  if (res.size() < n - 1) {
    printf("-1\n");
    return 0;
  }
  printf("%d\n", res.size());
  for (int i = 0; i < res.size(); i++)
    printf("%d%c", res[i], i + 1 < res.size() ? ' ' : '\n');
  return 0;
}