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 inf = 1e9 + 1;
const int N = 5e3 + 1;
int tot = 0, cnt = 0;
int n, m, k;
vector<pair<int, int>> adj[N];
set<pair<int, int>> t[N];
int p[N], cst[N];
void dfs(int v) {
  for (auto to = t[v].begin(); to != t[v].end(); to++) {
    int u = to->first;
    if (u != p[v]) {
      p[u] = v;
      cst[u] = to->second;
      dfs(u);
    }
  }
}
int solve(int v) {
  memset(p, -1, sizeof(p));
  memset(cst, -1, sizeof(cst));
  dfs(0);
  int max_w = 0, ans = -1;
  while (p[v] != 0) {
    if (cst[v] > max_w) {
      max_w = cst[v];
      ans = v;
    }
    v = p[v];
  }
  if (ans == -1) {
    cnt++;
    return inf;
  }
  t[ans].erase(make_pair(p[ans], max_w));
  t[p[ans]].erase(make_pair(ans, max_w));
  return max_w;
}
void prim() {
  vector<int> d(n, inf), par(n, -1);
  vector<bool> vis(n, false);
  set<pair<int, int>> q;
  for (int i = 1; i < n; i++) {
    if (vis[i]) continue;
    d[i] = 0;
    q.insert(make_pair(d[i], i));
    while (!q.empty()) {
      int v = q.begin()->second;
      vis[v] = true;
      tot += q.begin()->first;
      q.erase(q.begin());
      if (par[v] != -1) {
        t[v].insert(make_pair(par[v], d[v]));
        t[par[v]].insert(make_pair(v, d[v]));
      }
      for (auto to : adj[v]) {
        int u = to.first, c = to.second;
        if (!vis[u] && c < d[u]) {
          q.erase(make_pair(d[u], u));
          d[u] = c;
          par[u] = v;
          q.insert(make_pair(d[u], u));
        }
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m >> k;
  map<pair<int, int>, int> idmap;
  for (int i = 0; i < m; i++) {
    int u, v, c;
    cin >> u >> v >> c;
    if (u > v) swap(u, v);
    u--;
    v--;
    if (u != 0) adj[v].push_back(make_pair(u, c));
    adj[u].push_back(make_pair(v, c));
    idmap[make_pair(u, v)] = i + 1;
    idmap[make_pair(v, u)] = i + 1;
  }
  prim();
  if ((int)adj[0].size() < k) return puts("-1"), 0;
  sort(adj[0].begin(), adj[0].end(),
       [&](pair<int, int> I, pair<int, int> J) { return I.second < J.second; });
  vector<pair<int, pair<int, int>>> a;
  for (auto out : adj[0]) {
    a.push_back(make_pair(out.second - solve(out.first), out));
    t[0].insert(out);
    t[out.first].insert(make_pair(0, out.second));
  }
  sort(a.begin(), a.end());
  vector<int> d(n, inf), vis(n, false), par(n, -1);
  vis[0] = true;
  set<pair<int, int>> q;
  vector<int> eddie;
  int ans = 0;
  for (int i = 0; i < k; i++) {
    int u = a[i].second.first, c = a[i].second.second;
    vis[u] = true;
    d[u] = c;
    ans += c;
    q.insert(make_pair(0, u));
    eddie.push_back(idmap[make_pair(0, u)]);
  }
  while (!q.empty()) {
    int v = q.begin()->second;
    vis[v] = true;
    ans += q.begin()->first;
    q.erase(q.begin());
    if (par[v] != -1) {
      eddie.push_back(idmap[make_pair(par[v], v)]);
    }
    for (auto to : adj[v]) {
      int u = to.first, c = to.second;
      if (!vis[u] && c < d[u]) {
        q.erase(make_pair(d[u], u));
        d[u] = c;
        par[u] = v;
        q.insert(make_pair(d[u], u));
      }
    }
  }
  for (int i = 0; i < n; i++)
    if (!vis[i]) {
      return puts("-1"), 0;
    }
  cout << eddie.size() << "\n";
  for (auto u : eddie) {
    cout << u << " ";
  }
  return 0;
}