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 MAXN = 5005;
const int MAXM = 1e5 + 5;
const int INF = 0x3f3f3f3f;
int n, m, k, cnt, ecnt;
int fa[MAXN], minE[MAXN];
int in[MAXM];
struct node {
  int u, v, val, id;
  node() {}
  node(int a, int b, int c, int d) : u(a), v(b), val(c), id(d) {}
  bool operator<(const node &a) const { return val < a.val; }
} dp[MAXN], edge[MAXM];
vector<node> head[MAXN];
bool cmp(node a, node b) { return a.id < b.id; }
void add_edge(int u, int v, int val, int id) {
  head[u].push_back(node(u, v, val, id));
}
int find(int x) {
  if (fa[x] == x) return x;
  return fa[x] = find(fa[x]);
}
void un(int x, int y) { fa[find(x)] = find(y); }
void kruskal() {
  sort(edge + 1, edge + m + 1);
  for (int i = 1; i <= m; i++) {
    int u = edge[i].u, v = edge[i].v, id = edge[i].id;
    if (u == 1 || v == 1) continue;
    if (find(u) != find(v)) {
      un(u, v);
      in[id] = 1;
    }
  }
  sort(edge + 1, edge + m + 1, cmp);
}
void dfs(int u, int fa) {
  for (int i = 0; i < (int)head[u].size(); i++) {
    int v = head[u][i].v, val = head[u][i].val;
    int id = head[u][i].id;
    if (v == fa || !in[id]) continue;
    if (dp[v].val == -1) {
      if (dp[u].val > val)
        dp[v] = dp[u];
      else {
        dp[v].u = u;
        dp[v].v = v;
        dp[v].val = val;
        dp[v].id = id;
      }
    }
    dfs(v, u);
  }
}
bool solve() {
  for (int i = 0; i < (int)head[1].size(); i++) {
    int v = head[1][i].v, val = head[1][i].val;
    int id = head[1][i].id;
    int co = find(v);
    if (edge[minE[co]].val > val) minE[co] = id;
  }
  for (int i = 2; i <= n; i++)
    if (edge[minE[i]].val != INF) {
      cnt++;
      in[minE[i]] = 1;
    }
  if (cnt > k) return 0;
  for (int i = cnt + 1; i <= k; i++) {
    memset(dp, -1, sizeof dp);
    dp[1].v = -INF;
    for (int j = 0; j < (int)head[1].size(); j++)
      if (in[head[1][j].id]) dp[head[1][j].v].val = -INF;
    dfs(1, -1);
    int minnum = INF, idx, minid;
    for (int j = 0; j < (int)head[1].size(); j++) {
      int v = head[1][j].v, val = head[1][j].val;
      int id = head[1][j].id;
      if (val - dp[v].val < minnum) {
        minnum = val - dp[v].val;
        idx = v;
        minid = id;
      }
    }
    in[minid] = 1;
    in[dp[idx].id] = 0;
  }
  return 1;
}
int main() {
  edge[0].val = INF;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++) {
    int u, v, val;
    scanf("%d%d%d", &u, &v, &val);
    edge[++ecnt] = node(u, v, val, i);
    add_edge(u, v, val, i);
    add_edge(v, u, val, i);
  }
  kruskal();
  if (!solve()) {
    printf("-1");
    return 0;
  }
  printf("%d\n", n - 1);
  for (int i = 1; i <= m; i++)
    if (in[i]) printf("%d ", i);
}