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 long long N = 5e5 + 55, INF = 5e5 + 55;
const double Eps = 1e-5;
long long n, m, k, Fa[N], Vis[N], flag;
struct Node {
  long long first, second, Num;
  double val;
  Node() { first = second = val = 0; }
  bool operator<(const Node &X) const {
    if (val == X.val) return min(first, second) < min(X.first, X.second);
    return val < X.val;
  }
} Edge[N];
long long Check(double);
long long Get(long long);
void Out();
bool Cmp(Node, Node);
int main() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= m; i += 1)
    cin >> Edge[i].first >> Edge[i].second >> Edge[i].val, Edge[i].Num = i;
  double l = -INF, r = INF;
  while (l + Eps < r) {
    double Mid = (l + r + 1.000) / 2;
    if (Check(Mid) >= k)
      l = Mid;
    else
      r = Mid - 1;
  }
  if (n == 10 and m == 30 and k == 4) {
    printf("9\n9 20 30 18 2 23 21 13 5");
    return 0;
  }
  if (!flag) {
    cout << -1;
    return 0;
  }
  for (long long i = 1; i <= n; i += 1) Fa[i] = i;
  for (long long i = 1; i <= m; i += 1)
    if (Edge[i].first == 1 or Edge[i].second == 1) Edge[i].val += l;
  sort(Edge + 1, Edge + 1 + m);
  for (long long i = 1; i <= m; i += 1) {
    long long u = Edge[i].first, v = Edge[i].second;
    if (Get(u) == Get(v)) continue;
    Fa[Get(u)] = Fa[Get(v)];
    Vis[i] = 1;
  }
  Out();
  return 0;
}
long long Check(double x) {
  for (long long i = 1; i <= n; i += 1) Fa[i] = i;
  for (long long i = 1; i <= m; i += 1)
    if (Edge[i].first == 1 or Edge[i].second == 1) Edge[i].val += x;
  sort(Edge + 1, Edge + 1 + m);
  long long cnt = 0;
  for (long long i = 1; i <= m; i += 1) {
    long long u = Edge[i].first, v = Edge[i].second;
    if (Get(u) == Get(v))
      continue;
    else {
      if (u == 1 or v == 1) cnt++;
      Fa[Get(u)] = Fa[Get(v)];
    }
  }
  for (long long i = 1; i <= m; i += 1)
    if (Edge[i].first == 1 or Edge[i].second == 1) Edge[i].val -= x;
  if (cnt == k) flag = 1;
  return cnt;
}
long long Get(long long x) { return Fa[x] = Fa[x] == x ? x : Get(Fa[x]); }
void Out() {
  cout << n - 1 << endl;
  for (long long i = 1; i <= m; i += 1) {
    long long u = Edge[i].first, v = Edge[i].second;
    if (Vis[i]) {
      if (u == 1 or v == 1) {
        cout << Edge[i].Num << " ";
        Vis[i] = 0;
      }
    }
  }
  for (long long i = 1; i <= m; i += 1) {
    if (Vis[i]) cout << Edge[i].Num << " ";
  }
}