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 <class T>
T sq(T x) {
  return x * x;
}
const long long inf = 2147383647;
const double pi = 2 * acos(0.0);
const double eps = 1e-7;
const long long maxint = 2147483647;
const long long minint = -2147483648;
long long gcd(long long a, long long b) {
  while (b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long power(long long a, long long p) {
  long long res = 1, x = a;
  while (p) {
    if (p & 1) res = res * x;
    x = x * x;
    p >>= 1;
  }
  return res;
}
long long bigmod(long long a, long long p, long long mod) {
  long long res = 1, x = a;
  while (p) {
    if (p & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    p >>= 1;
  }
  return res;
}
int pset[6000];
int find_union(int x) {
  if (pset[x] == x) return x;
  pset[x] = find_union(pset[x]);
  return pset[x];
}
void make_union(int x, int y) { pset[find_union(x)] = find_union(y); }
int n, m, k;
struct edge {
  int a, b, w, ind;
  double d;
} ed[100010];
bool compare(const edge &a, const edge &b) {
  if (a.d + eps < b.d)
    return true;
  else if (fabs(a.d - b.d) <= eps && a.ind < b.ind)
    return true;
  else
    return false;
}
int ans[6000];
int mst(double x) {
  int i;
  for (i = 0; i < m; i++) {
    if (ed[i].a == 1 || ed[i].b == 1)
      ed[i].d = ed[i].w + x;
    else
      ed[i].d = ed[i].w;
  }
  sort(ed, ed + m, compare);
  for (i = 1; i <= n; i++) pset[i] = i;
  int res = 0;
  int taken = 0;
  for (i = 0; i < m; i++) {
    int u = find_union(ed[i].a);
    int v = find_union(ed[i].b);
    if (u != v) {
      make_union(u, v);
      if (ed[i].a == 1 || ed[i].b == 1) res++;
      ans[taken++] = ed[i].ind;
    }
  }
  return res;
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  int i;
  for (i = 0; i < m; i++) {
    scanf("%d %d %d", &ed[i].a, &ed[i].b, &ed[i].w);
    ed[i].ind = i + 1;
  }
  double low = -10000000, high = 10000000;
  while (low + eps < high) {
    double mid = (low + high) / 2;
    int x = mst(mid);
    if (x > k) {
      low = mid;
    } else
      high = mid;
  }
  if (mst(low) != k && mst(high) != k)
    printf("-1\n");
  else {
    printf("%d\n", n - 1);
    for (i = 0; i < n - 1; i++) {
      if (i) printf(" ");
      printf("%d", ans[i]);
    }
    puts("");
  }
  return 0;
}