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 N = 1e5 + 7, MAXN = 1e6 + 7, INF = 0x3f3f3f3f;
long long fpow(long long a, long long b, long long p) {
  long long ans = 1LL;
  while (b) {
    if (b & 1) ans = ans * a % p;
    b >>= 1;
    a = a * a % p;
  }
  return ans % p;
}
int n, m, k;
int a[N], fa[N];
int get(int x) { return x == fa[x] ? x : fa[x] = get(fa[x]); }
struct node {
  int u, v, w, id, c;
  node(int x = 0, int y = 0, int z = 0, int i = 0, int cl = 0) {
    u = x;
    v = y;
    w = z;
    id = i;
    c = cl;
  }
  bool operator<(const node &p) const { return w == p.w ? c > p.c : w < p.w; }
} ver[N];
int num[N];
bool check(int x) {
  for (int i = 1; i <= m; i++)
    if (ver[i].c == 1) ver[i].w += x;
  sort(ver + 1, ver + m + 1);
  for (int i = 1; i <= n; i++) fa[i] = i;
  int cnt = 0, t = 0;
  for (int i = 1; i <= m; i++) {
    int x = get(ver[i].u), y = get(ver[i].v);
    if (x == y) continue;
    fa[x] = y;
    cnt += ver[i].c;
    t++;
    if (t == n - 1) break;
  }
  if (t != n - 1) return false;
  for (int i = 1; i <= m; i++)
    if (ver[i].c == 1) ver[i].w -= x;
  return cnt >= k;
}
void print(int x) {
  for (int i = 1; i <= m; i++)
    if (ver[i].c == 1) ver[i].w += x;
  sort(ver + 1, ver + m + 1);
  for (int i = 1; i <= n; i++) fa[i] = i;
  int t = 0;
  int cnt = 0;
  for (int i = 1; i <= m; i++) {
    int x = get(ver[i].u), y = get(ver[i].v);
    if ((x == y) || (ver[i].u == 1 && cnt == k)) continue;
    fa[x] = y;
    num[++t] = ver[i].id;
    cnt += ver[i].c;
    if (t == n - 1) break;
  }
  if (cnt < k || t != n - 1) {
    puts("-1");
    return;
  }
  printf("%d\n", t);
  for (int i = 1; i <= t; i++) printf("%d%c", num[i], i == t ? '\n' : ' ');
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= m; i++) {
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);
    if (x > y) swap(x, y);
    int cl = 0;
    if (x == 1) cl = 1;
    ver[i] = node(x, y, z, i, cl);
  }
  int l = -1e5, r = 1e5 + 7, anss = INF;
  while (l <= r) {
    int mid = l + r >> 1;
    if (check(mid))
      l = mid + 1, anss = mid;
    else
      r = mid - 1;
  }
  if (anss == INF)
    puts("-1");
  else
    print(anss);
  return 0;
}