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;
int ecnt;
struct Edge {
  int to, w, id;
  Edge *next;
} * mat[5010], edges[100010 * 2];
void link(int x, int to, int w, int id) {
  edges[ecnt].to = to;
  edges[ecnt].id = id;
  edges[ecnt].w = w;
  edges[ecnt].next = mat[x];
  mat[x] = &edges[ecnt++];
}
bool in_tree[5010][5010];
struct Node {
  int x, y, w, id;
  bool friend operator<(const Node &a, const Node &b) { return a.w < b.w; }
} input[100010];
int n, m, K;
int cost[5010], w[5010][2], p[5010];
int Find(int x) { return p[x] = (x == p[x] ? x : Find(p[x])); }
void dfs(int x, int father) {
  for (Edge *it = mat[x]; it; it = it->next) {
    int to = it->to;
    if (!in_tree[x][to] || to == father) continue;
    w[to][0] = it->w > cost[x] ? x : w[x][0];
    w[to][1] = it->w > cost[x] ? to : w[x][1];
    cost[to] = max(it->w, cost[x]);
    dfs(to, x);
  }
}
void show(int x, int father) {
  for (Edge *it = mat[x]; it; it = it->next) {
    int to = it->to;
    if (!in_tree[to][x] || to == father) continue;
    printf("%d ", it->id);
    show(to, x);
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &K);
  for (int i = 0; i < m; i++) {
    int x, y, w;
    scanf("%d%d%d", &x, &y, &w);
    link(x, y, w, i + 1);
    link(y, x, w, i + 1);
    input[i].x = x, input[i].y = y, input[i].w = w;
    input[i].id = i + 1;
  }
  sort(input, input + m);
  for (int i = 1; i <= n; i++) w[p[i] = i][0] = -1;
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    int x = input[i].x, y = input[i].y;
    if (x == 1 || y == 1) continue;
    if (Find(x) == Find(y)) continue;
    in_tree[x][y] = in_tree[y][x] = true;
    p[Find(x)] = Find(y);
  }
  for (Edge *it = mat[1]; it; it = it->next) {
    int to = it->to;
    int k = p[Find(to)];
    if (w[k][0] == -1 || cost[k] > it->w) {
      cost[k] = it->w;
      w[k][0] = to;
    }
  }
  bool flag = true;
  for (int i = 2; i <= n && flag; i++)
    if (Find(i) == i) {
      if (w[i][0] == -1) {
        flag = false;
        break;
      }
      in_tree[1][w[i][0]] = in_tree[w[i][0]][1] = true;
      K--;
    }
  flag &= K >= 0;
  for (Edge *it = mat[1]; it; it = it->next) {
    int to = it->to;
    if (!in_tree[1][to]) continue;
    cost[to] = -1;
    dfs(to, 1);
  }
  while (flag && K > 0) {
    int ans, id = -1;
    for (Edge *it = mat[1]; it; it = it->next) {
      int to = it->to;
      if (in_tree[1][to]) continue;
      if (id == -1 || ans > it->w - cost[to]) {
        ans = it->w - cost[to];
        id = to;
      }
    }
    if (id == -1) {
      flag = false;
      break;
    }
    in_tree[w[id][0]][w[id][1]] = false;
    in_tree[w[id][1]][w[id][0]] = false;
    in_tree[1][id] = in_tree[id][1] = true;
    cost[id] = -1;
    dfs(id, 1);
    K--;
  }
  if (flag) {
    printf("%d\n", n - 1);
    show(1, -1);
  } else
    printf("-1\n");
  return 0;
}