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;
using ll = long long;
using pii = pair<int, int>;
const int INF = 0x3f3f3f3f, N = 5e3 + 5, M = 2e5 + 5;
int n, m, k, f[N];
int dp[N], con[N][N];
bool vis[M];
struct edge {
  int u, v, w, id;
  bool operator<(const edge &a) const { return w < a.w; }
} e[M];
vector<edge> G, rt;
int find(int x) {
  if (x == f[x]) return x;
  return f[x] = find(f[x]);
}
void dfs(int u, int pre, int id) {
  if (e[id].w >= e[dp[pre]].w)
    dp[u] = id;
  else
    dp[u] = dp[pre];
  for (int i = 1; i <= n; i++) {
    if (con[u][i] && i != pre) dfs(i, u, con[i][u]);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) f[i] = i;
  for (int i = 1; i <= m; i++) {
    cin >> e[i].u >> e[i].v >> e[i].w;
    e[i].id = i;
    if (e[i].u == 1)
      rt.push_back({e[i].u, e[i].v, e[i].w, i});
    else if (e[i].v == 1)
      rt.push_back({e[i].v, e[i].u, e[i].w, i});
    else
      G.push_back({e[i].u, e[i].v, e[i].w, i});
  }
  sort(G.begin(), G.end());
  sort(rt.begin(), rt.end());
  int cnt = 0;
  for (int i = 0; i < G.size(); i++) {
    int fx = find(G[i].u), fy = find(G[i].v);
    if (fx ^ fy) {
      f[fx] = fy;
      vis[G[i].id] = 1;
      con[G[i].u][G[i].v] = con[G[i].v][G[i].u] = G[i].id;
    }
  }
  for (int i = 0; i < rt.size(); i++) {
    int fx = find(rt[i].u), fy = find(rt[i].v);
    if (fx ^ fy) {
      f[fx] = fy;
      dfs(rt[i].v, 0, 0);
      vis[rt[i].id] = 1;
      cnt++;
    }
  }
  int blo = 0;
  for (int i = 1; i <= n; i++)
    if (f[i] == i) blo++;
  if (blo > 1 || rt.size() < k || cnt > k) {
    cout << -1 << '\n';
    return 0;
  }
  cnt = k - cnt;
  while (cnt--) {
    int minn = INF, id = 0, del = 0, add = 0;
    for (int i = 0; i < rt.size(); i++) {
      if (vis[rt[i].id]) continue;
      if (minn > e[rt[i].id].w - e[dp[rt[i].v]].w) {
        minn = e[rt[i].id].w - e[dp[rt[i].v]].w;
        id = rt[i].id;
        del = dp[rt[i].v];
        add = rt[i].v;
      }
    }
    vis[id] = 1;
    vis[del] = 0;
    con[e[del].u][e[del].v] = con[e[del].v][e[del].u] = 0;
    dfs(add, 0, 0);
  }
  cout << n - 1 << '\n';
  for (int i = 1; i <= m; i++)
    if (vis[i]) cout << i << ' ';
  cout << '\n';
  return 0;
}