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 MAXN = 5000;
const int MAXM = 100000;
struct edge {
  int u, v, id;
  long long w;
  bool flag;
} edges[MAXM + 5];
bool cmp(edge a, edge b) { return a.w < b.w; }
int n, m, k;
void Read() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%I64d", &edges[i].u, &edges[i].v, &edges[i].w);
    edges[i].id = i;
  }
}
int fa[MAXN + 5];
int Find(int x) {
  if (x == fa[x]) return x;
  return fa[x] = Find(fa[x]);
}
void Kruscal() {
  sort(edges + 1, edges + m + 1, cmp);
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1; i <= m; i++)
    if (edges[i].u != 1 && edges[i].v != 1) {
      if (Find(edges[i].u) != Find(edges[i].v)) {
        edges[i].flag = true;
        fa[Find(edges[i].u)] = Find(edges[i].v);
      }
    }
}
int mini[MAXN + 5];
vector<int> List, G[MAXN + 5];
void addedge(int u, int v, int p) {
  G[u].push_back(p);
  G[v].push_back(p);
}
void dfs(int rt, int pre, int key) {
  mini[rt] = key;
  for (int i = 0; i < G[rt].size(); i++) {
    if (edges[G[rt][i]].u == rt) {
      if (edges[G[rt][i]].v == pre) continue;
      if (key == -1 || edges[key].w < edges[G[rt][i]].w)
        dfs(edges[G[rt][i]].v, rt, G[rt][i]);
      else
        dfs(edges[G[rt][i]].v, rt, key);
    } else {
      if (edges[G[rt][i]].u == pre) continue;
      if (key == -1 || edges[key].w < edges[G[rt][i]].w)
        dfs(edges[G[rt][i]].u, rt, G[rt][i]);
      else
        dfs(edges[G[rt][i]].u, rt, key);
    }
  }
}
int main() {
  Read();
  Kruscal();
  for (int i = 1; i <= m; i++) {
    if (edges[i].u == 1) {
      if (mini[Find(edges[i].v)] == 0) {
        mini[Find(edges[i].v)] = i;
        edges[i].flag = true;
      }
      List.push_back(i);
    } else if (edges[i].v == 1) {
      if (mini[Find(edges[i].u)] == 0) {
        mini[Find(edges[i].u)] = i;
        edges[i].flag = true;
      }
      List.push_back(i);
      swap(edges[i].u, edges[i].v);
    }
  }
  long long ans = 0, res = 0;
  for (int i = 1; i <= m; i++)
    if (edges[i].flag) ans += edges[i].w;
  int num = 0;
  for (int i = 2; i <= n; i++)
    if (fa[i] == i) num++;
  res = ans;
  if (num == k) {
    printf("%d\n", n - 1);
    for (int j = 1; j <= m; j++)
      if (edges[j].flag) printf("%d ", edges[j].id);
    return 0;
  }
  for (int i = num + 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) G[j].clear();
    for (int j = 1; j <= m; j++)
      if (edges[j].flag) addedge(edges[j].u, edges[j].v, j);
    for (int j = 0; j < G[1].size(); j++) dfs(edges[G[1][j]].v, 1, -1);
    int p = -1;
    for (int j = 0; j < List.size(); j++) {
      if (edges[List[j]].flag == true) continue;
      if (p == -1 || edges[List[j]].w - edges[mini[edges[List[j]].v]].w <
                         edges[p].w - edges[mini[edges[p].v]].w)
        p = List[j];
    }
    if (p == -1) break;
    ans = ans + edges[p].w - edges[mini[edges[p].v]].w;
    edges[mini[edges[p].v]].flag = false;
    edges[p].flag = true;
    res = min(res, ans);
    if (i == k) {
      printf("%d\n", n - 1);
      for (int j = 1; j <= m; j++)
        if (edges[j].flag) printf("%d ", edges[j].id);
      return 0;
    }
  }
  printf("%d\n", -1);
}