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 n, m, k;
int a[100000], b[100000], c[100000];
int order[100000];
int father[5001];
int best[5001];
int cand[5001];
bool inC[100000];
vector<int> info;
vector<int> to;
vector<int> mynext;
int cmp(const int &oi, const int &oj) { return c[oi] < c[oj]; }
void read_data() {
  cin >> n >> m >> k;
  int u, v, w;
  info.resize(n + 1);
  mynext.reserve(m + m);
  to.reserve(m + m);
  for (int i = 1; i <= n; i++) info[i] = -1;
  for (int i = 0; i < m; i++) {
    scanf("%d %d %d", &u, &v, &w);
    if (u > v) {
      int t = u;
      u = v;
      v = t;
    }
    a[i] = u;
    b[i] = v;
    c[i] = w;
    mynext.push_back(info[u]);
    info[u] = to.size();
    to.push_back(v);
    mynext.push_back(info[v]);
    info[v] = to.size();
    to.push_back(u);
    order[i] = i;
  }
  sort(order, order + m, cmp);
  memset(inC, 0, sizeof(inC));
  for (int i = 1; i <= n; i++) father[i] = i;
}
int getF(int u) { return father[u] != u ? father[u] = getF(father[u]) : u; }
int kruskal() {
  int component = n;
  for (int i = 0; i < m; i++) {
    int ord = order[i];
    if (a[ord] == 1) continue;
    int fu = getF(a[ord]);
    int fv = getF(b[ord]);
    if (fu != fv) {
      component--;
      inC[ord] = true;
      father[fu] = fv;
    }
  }
  return component;
}
void dfs(int p, int u) {
  for (int i = info[u]; i != -1; i = mynext[i]) {
    int v = to[i];
    int ord = i / 2;
    if (v == p || !inC[ord]) continue;
    if (u != 1) {
      best[v] = best[u];
      cand[v] = cand[u];
      if (best[v] == -1 || best[v] < c[ord]) {
        best[v] = c[ord];
        cand[v] = ord;
      }
    } else {
      best[v] = -1;
    }
    dfs(u, v);
  }
}
vector<int> deal() {
  int counter = 0;
  for (int i = info[1]; i != -1; i = mynext[i]) counter++;
  if (counter < k) return vector<int>(1, -1);
  int component = kruskal();
  if (k < component - 1) return vector<int>(1, -1);
  for (int i = 0; i < m; i++) {
    int ord = order[i];
    if (a[ord] != 1) continue;
    int v = b[ord];
    int fv = getF(v);
    if (fv != 1) {
      k--;
      inC[ord] = true;
      father[fv] = 1;
    }
  }
  int f1 = getF(1);
  for (int v = 2; v <= n; v++) {
    int fv = getF(v);
    if (fv != f1) return vector<int>(1, -1);
  }
  while (k-- > 0) {
    dfs(-1, 1);
    int tbest = -0x3f3f3f3f, tcand;
    int nord;
    for (int i = info[1]; i != -1; i = mynext[i]) {
      int ord = i / 2;
      if (inC[ord]) continue;
      int v = to[i];
      if (tbest == -0x3f3f3f3f || tbest < best[v] - c[ord]) {
        tbest = best[v] - c[ord];
        tcand = cand[v];
        nord = ord;
      }
    }
    if (-0x3f3f3f3f == tbest) return vector<int>(1, -1);
    inC[tcand] = false;
    inC[nord] = true;
  }
  vector<int> ret;
  for (int i = 0; i < m; i++)
    if (inC[i]) ret.push_back(i + 1);
  return ret;
}
int main() {
  read_data();
  vector<int> ret = deal();
  if (ret.size() == 1 && ret[0] == -1) {
    cout << (-1) << endl;
  } else {
    cout << ret.size() << endl;
    if (ret.size() > 0) {
      for (int i = 0; i < ret.size(); i++) printf("%d ", ret[i]);
      cout << endl;
    }
  }
  return 0;
}