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 = 5005, M = 2e5 + 5;
const int INF = 0x3f3f3f3f;
struct node {
  int u, v, w, nxt, pos;
} e[M], edge[M];
int head[N], mcnt;
void add_edge(int u, int v, int w, int pos) {
  mcnt++;
  edge[mcnt].u = u;
  edge[mcnt].v = v;
  edge[mcnt].w = w;
  edge[mcnt].pos = pos;
  edge[mcnt].nxt = head[u];
  head[u] = mcnt;
}
int n, m, k;
int fa[N];
int dp[N];
bool vis[M];
bool cmp(node a, node b) { return a.w < b.w; }
int find_father(int x) {
  if (fa[x] == x) return x;
  return fa[x] = find_father(fa[x]);
}
void merge(int x, int y) {
  int f1 = find_father(x), f2 = find_father(y);
  fa[f1] = f2;
}
void Kruscal() {
  sort(e + 1, e + m + 1, cmp);
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++) {
    int u = e[i].u, v = e[i].v;
    if (u == 1 || v == 1) continue;
    if (find_father(u) != find_father(v)) {
      merge(u, v);
      vis[e[i].pos] = 1;
    }
  }
}
void dfs(int u, int fa) {
  for (int i = head[u]; i; i = edge[i].nxt) {
    int v = edge[i].v, w = edge[i].w;
    int d = (dp[u] == -INF || dp[u] == -1) ? -INF : edge[dp[u]].w;
    if (v == fa || !vis[edge[i].pos]) continue;
    if (dp[v] == -1) {
      if (d > w)
        dp[v] = dp[u];
      else {
        dp[v] = i;
      }
    }
    dfs(v, u);
  }
}
int me[N];
void solve() {
  for (int i = head[1]; i; i = edge[i].nxt) {
    int v = edge[i].v, w = edge[i].w;
    int f = find_father(v);
    if (me[f] == -1 || edge[me[f]].w > w) {
      me[f] = i;
    }
  }
  int du = 0;
  for (int i = 1; i <= n; i++)
    if (me[i] != -1) {
      du++;
      vis[edge[me[i]].pos] = 1;
    }
  int cnt = 0;
  for (int i = head[1]; i; i = edge[i].nxt) cnt++;
  if (cnt < k || du > k) {
    printf("-1");
    exit(0);
  }
  for (int t = du + 1; t <= k; t++) {
    memset(dp, -1, sizeof dp);
    dp[1] = -INF;
    for (int i = head[1]; i; i = edge[i].nxt)
      if (vis[edge[i].pos]) {
        dp[edge[i].v] = -INF;
      }
    dfs(1, -1);
    int id, mn = INF;
    for (int i = head[1]; i; i = edge[i].nxt) {
      if (dp[edge[i].v] != -INF && mn > edge[i].w - edge[dp[edge[i].v]].w) {
        mn = edge[i].w - edge[dp[edge[i].v]].w;
        id = i;
      }
    }
    vis[edge[id].pos] = 1;
    vis[edge[dp[edge[id].v]].pos] = 0;
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= m; i++) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    e[i].u = u, e[i].v = v, e[i].w = w, e[i].pos = i;
    add_edge(u, v, w, i);
    add_edge(v, u, w, i);
  }
  memset(me, -1, sizeof me);
  Kruscal();
  solve();
  printf("%d\n", n - 1);
  for (int i = 1; i <= m; i++)
    if (vis[e[i].pos]) printf("%d ", e[i].pos);
}