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;
struct edge {
  int x, y, w, r;
  bool vis;
  bool operator<(const struct edge T) const { return w < T.w; }
};
struct Edge {
  int y, w, next, r;
  int num;
  bool vis;
} e[5002 * 2];
edge a[100002];
int n, m, k, pa[5002], cnt, he[5002];
int la[5002], lan[5002];
vector<int> v;
int find(int x) { return pa[x] == x ? x : pa[x] = find(pa[x]); }
void addEdge(int x, int y, int z, int zz) {
  e[cnt].num = zz;
  e[cnt].vis = 1;
  e[cnt].r = cnt;
  e[cnt].y = y;
  e[cnt].w = z;
  e[cnt].next = he[x];
  he[x] = cnt++;
  e[cnt].num = zz;
  e[cnt].vis = 1;
  e[cnt].r = cnt;
  e[cnt].y = x;
  e[cnt].w = z;
  e[cnt].next = he[y];
  he[y] = cnt++;
}
void init() {
  cnt = 0;
  memset(he, -1, sizeof(he));
}
void dfs(int u, int fa) {
  for (int i = he[u]; i != -1; i = e[i].next) {
    Edge t = e[i];
    if (t.y == fa || !t.vis) continue;
    if (u != 1) {
      la[t.y] = t.w;
      lan[t.y] = t.r;
      if (la[t.y] < la[u]) {
        la[t.y] = la[u];
        lan[t.y] = lan[u];
      }
    }
    dfs(t.y, u);
  }
}
int main() {
  init();
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &a[i].x, &a[i].y, &a[i].w);
    if (a[i].x > a[i].y) swap(a[i].x, a[i].y);
    a[i].r = i;
  }
  sort(a, a + m);
  for (int i = 1; i <= n; i++) pa[i] = i;
  for (int i = 0; i < m; i++) {
    if (a[i].x == 1)
      v.push_back(i);
    else {
      int x = find(a[i].x);
      int y = find(a[i].y);
      if (x != y) {
        pa[x] = y;
        a[i].vis = 1;
      }
    }
  }
  int tot = 0, ca = 0;
  for (int i = 2; i <= n; i++)
    if (find(i) == i) tot++;
  if (tot > v.size() || tot > k) {
    puts("-1");
    return 0;
  }
  for (vector<int>::iterator it = v.begin(); it != v.end(); it++) {
    int t = find(a[*it].y);
    if (t != 1) {
      pa[t] = 1;
      a[*it].vis = 1;
      ca++;
    }
  }
  if (ca != tot) {
    puts("-1");
    return 0;
  }
  for (int i = 0; i < m; i++)
    if (a[i].vis) addEdge(a[i].x, a[i].y, a[i].w, i);
  while (tot < k) {
    memset(la, 0, sizeof(la));
    memset(lan, 0, sizeof(lan));
    dfs(1, 0);
    int minx = 0x7fffffff, tt;
    for (vector<int>::iterator it = v.begin(); it != v.end(); it++) {
      if (a[*it].vis) continue;
      if (minx > a[*it].w - la[a[*it].y]) {
        tt = *it;
        minx = a[*it].w - la[a[*it].y];
      }
    }
    addEdge(1, a[tt].y, a[tt].w, tt);
    e[lan[a[tt].y]].vis = 0;
    e[lan[a[tt].y] ^ 1].vis = 0;
    a[e[lan[a[tt].y]].num].vis = 0;
    a[e[lan[a[tt].y] ^ 1].num].vis = 0;
    a[tt].vis = 1;
    k--;
  }
  printf("%d\n", n - 1);
  for (int i = 0; i < m; i++) {
    if (a[i].vis) printf("%d ", a[i].r + 1);
  }
  return 0;
}