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 cd = complex<double>;
const long long INF = 1e18;
const long long mod = 998244353;
const double Pi = acos(-1);
void Fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
struct Edge {
  long long u, v, c;
  Edge(long long u, long long v, long long c) : u(u), v(v), c(c){};
};
long long n, m, k;
long long dsu[5005], dp[5005], father[5005], id[5005];
vector<Edge> E, W, P;
vector<pair<long long, long long> > Adj[5005];
map<pair<long long, long long>, long long> M;
set<long long> Ans;
bool Compare(Edge A, Edge B) { return A.c < B.c; }
long long Root(long long node) {
  return node == dsu[node] ? node : dsu[node] = Root(dsu[node]);
}
void DFS(long long node, long long p) {
  for (auto x : Adj[node]) {
    if (x.first == p) {
      continue;
    }
    father[x.first] = node;
    if (dp[node] < x.second) {
      id[x.first] = x.first;
    } else {
      id[x.first] = id[node];
    }
    dp[x.first] = max(dp[node], x.second);
    DFS(x.first, node);
  }
}
signed main() {
  Fastio();
  cin >> n >> m >> k;
  long long cnt = 0;
  for (long long i = 1; i <= n; i++) {
    dsu[i] = i;
  }
  for (long long i = 1; i <= m; i++) {
    long long u, v, c;
    cin >> u >> v >> c;
    M[make_pair(u, v)] = i;
    M[make_pair(v, u)] = i;
    P.emplace_back(u, v, c);
    if (u == 1 or v == 1) {
      W.emplace_back(min(u, v), max(u, v), c);
      continue;
    }
    E.emplace_back(u, v, c);
  }
  sort(E.begin(), E.end(), Compare);
  sort(W.begin(), W.end(), Compare);
  for (auto x : E) {
    if (Root(x.u) == Root(x.v)) {
      continue;
    }
    Adj[x.u].emplace_back(x.v, x.c);
    Adj[x.v].emplace_back(x.u, x.c);
    cnt++;
    dsu[Root(x.u)] = Root(x.v);
  }
  for (auto x : W) {
    if (x.u == 1 or x.v == 1) {
      if (Root(x.u) != Root(x.v)) {
        Adj[x.u].emplace_back(x.v, x.c);
        Adj[x.v].emplace_back(x.u, x.c);
        cnt++;
        k--;
        dsu[Root(x.u)] = Root(x.v);
      }
    }
  }
  if (cnt != n - 1 or k < 0) {
    cout << -1;
    return 0;
  }
  for (long long i = 1; i <= n; i++) {
    for (auto x : Adj[i]) {
      Ans.insert(M[make_pair(i, x.first)]);
    }
  }
  long long ans = 0;
  while (k--) {
    for (long long i = 1; i <= n; i++) {
      dp[i] = 0;
    }
    dp[1] = -1e10;
    for (auto x : Adj[1]) {
      dp[x.first] = -1e12;
      DFS(x.first, 1);
    }
    long long temp = 2e10, ii = -1, ww = 0;
    for (auto x : W) {
      if (x.c - dp[x.v] < temp) {
        temp = x.c - dp[x.v];
        ii = x.v;
        ww = x.c;
      }
    }
    if (ii == -1) {
      cout << -1;
      return 0;
    }
    Adj[1].emplace_back(ii, ww);
    Adj[ii].emplace_back(1, ww);
    ii = id[ii];
    for (long long i = 0; i < Adj[ii].size(); i++) {
      if (Adj[ii][i].first == father[ii]) {
        Adj[ii].erase(Adj[ii].begin() + i);
        break;
      }
    }
    for (long long i = 0; i < Adj[father[ii]].size(); i++) {
      if (Adj[father[ii]][i].first == ii) {
        Adj[father[ii]].erase(Adj[father[ii]].begin() + i);
        break;
      }
    }
    Ans.clear();
    for (long long i = 1; i <= n; i++) {
      for (auto x : Adj[i]) {
        Ans.insert(M[make_pair(i, x.first)]);
      }
    }
    long long ans = 0;
  }
  Ans.clear();
  ans = 0;
  for (long long i = 1; i <= n; i++) {
    for (auto x : Adj[i]) {
      Ans.insert(M[make_pair(i, x.first)]);
    }
  }
  cout << Ans.size() << '\n';
  for (auto x : Ans) {
    cout << x << ' ';
    ans += P[x - 1].c;
  }
}