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 
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:65777216")
using namespace std;
struct Edge {
  int x, y, w, id;
  Edge() { id = -1; }
  bool operator<(const Edge &s) const { return w < s.w; }
};
int n, m, k;
Edge e[111111];
int p[5555];
int P(int v) { return p[v] == v ? v : p[v] = P(p[v]); }
void join(int p1, int p2) { p[P(p2)] = P(p1); }
vector<Edge> t[5555];
vector<Edge> v[5555];
bool u[111111];
void add(Edge e) {
  u[e.id] = true;
  t[e.x].push_back(e);
  t[e.y].push_back(e);
}
void remove(Edge e) {
  u[e.id] = false;
  for (int TC(0); TC < (2); TC++) {
    for (int i(0); i < (t[e.x].size()); i++)
      if (t[e.x][i].id == e.id) {
        swap(t[e.x][i], t[e.x].back());
        t[e.x].pop_back();
        break;
      }
    swap(e.x, e.y);
  }
}
Edge d[5555];
void dfs(int ver, int par, Edge mx) {
  d[ver] = mx;
  for (int i(0); i < (t[ver].size()); i++) {
    int s = (t[ver][i].x == ver ? t[ver][i].y : t[ver][i].x);
    if (s != par) {
      dfs(s, ver,
          par != -1 && (mx.id == -1 || mx.w < t[ver][i].w) ? t[ver][i] : mx);
    }
  }
}
int q[5555];
void dfs2(int ver, int col) {
  if (ver == 0 || q[ver] == col) return;
  q[ver] = col;
  for (int i(0); i < (t[ver].size()); i++)
    dfs2(t[ver][i].x + t[ver][i].y - ver, col);
}
Edge mm[5555];
int main() {
  cin >> n >> m >> k;
  for (int i(0); i < (m); i++) {
    scanf("%d %d %d", &e[i].x, &e[i].y, &e[i].w);
    e[i].id = i;
    e[i].x--;
    e[i].y--;
    if (e[i].x > e[i].y) swap(e[i].x, e[i].y);
    v[e[i].x].push_back(e[i]);
    v[e[i].y].push_back(e[i]);
  }
  sort(e, e + m);
  for (int i(0); i < (n); i++) p[i] = i;
  int num = 0;
  for (int j(0); j < (m); j++)
    if (P(e[j].x) != P(e[j].y)) {
      join(e[j].x, e[j].y);
      t[e[j].x].push_back(e[j]);
      t[e[j].y].push_back(e[j]);
      u[e[j].id] = true;
      num++;
    }
  if (num != n - 1 || v[0].size() < k) {
    puts("-1");
    return 0;
  }
  while (t[0].size() < k) {
    dfs(0, -1, Edge());
    int pos = -1, cost = -1;
    for (int i(0); i < (v[0].size()); i++)
      if (!u[v[0][i].id])
        if (pos == -1 || v[0][i].w - d[v[0][i].y].w < cost)
          pos = i, cost = v[0][i].w - d[v[0][i].y].w;
    remove(d[v[0][pos].y]);
    add(v[0][pos]);
  }
  while (t[0].size() > k) {
    memset(q, -1, sizeof(q));
    for (int i(0); i < (t[0].size()); i++) {
      dfs2(t[0][i].y, i);
      mm[i].id = -1;
    }
    for (int i(0); i < (m); i++)
      if (e[i].x)
        if (q[e[i].x] != q[e[i].y]) {
          if (mm[q[e[i].x]].id == -1 || mm[q[e[i].x]].w > e[i].w)
            mm[q[e[i].x]] = e[i];
          if (mm[q[e[i].y]].id == -1 || mm[q[e[i].y]].w > e[i].w)
            mm[q[e[i].y]] = e[i];
        }
    int pos = -1;
    for (int i(0); i < (t[0].size()); i++)
      if (mm[i].id != -1)
        if (pos == -1 || mm[pos].w - t[0][pos].w > mm[i].w - t[0][i].w) pos = i;
    if (pos == -1) {
      puts("-1");
      return 0;
    }
    remove(t[0][pos]);
    add(mm[pos]);
  }
  cout << n - 1 << endl;
  bool f = 1;
  for (int i(0); i < (m); i++)
    if (u[i]) {
      if (!f) printf(" ");
      f = 0;
      printf("%d", i + 1);
    }
  puts("");
  return 0;
}
