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 = 5005, MAXM = 100005;
struct Edge {
  int u, v, len, id;
  Edge() {}
  Edge(int u, int v, int len, int id) : u(u), v(v), len(len), id(id) {}
  bool operator<(const Edge &t) const { return len < t.len; }
};
struct AdjEdge {
  int v, len, id;
  AdjEdge() {}
  AdjEdge(int v, int len, int id) : v(v), len(len), id(id) {}
};
int dsu[MAXN];
int Root(int x) {
  if (dsu[x] == 0) return x;
  return dsu[x] = Root(dsu[x]);
}
int n, m, k;
Edge edge[MAXM];
bool use[MAXM];
vector<AdjEdge> adj[MAXN];
void AddEdge(int i) {
  adj[edge[i].u].push_back(AdjEdge(edge[i].v, edge[i].len, i));
  adj[edge[i].v].push_back(AdjEdge(edge[i].u, edge[i].len, i));
}
void Kruskal() {
  sort(edge + 1, edge + m + 1);
  for (int i = 1; i <= m; i++) {
    if (edge[i].u == 1 || edge[i].v == 1) continue;
    int r1 = Root(edge[i].u), r2 = Root(edge[i].v);
    if (r1 == r2) continue;
    dsu[r1] = r2;
    AddEdge(i);
    use[i] = true;
  }
}
int dp[MAXN], dpid[MAXN];
void DP(int u, int f = 0) {
  for (int i = 0; i < (int)adj[u].size(); i++) {
    AdjEdge e = adj[u][i];
    if (e.v == f || !use[e.id]) continue;
    if (u != 1) {
      if (dp[u] > e.len)
        dp[e.v] = dp[u], dpid[e.v] = dpid[u];
      else
        dp[e.v] = e.len, dpid[e.v] = e.id;
    } else
      dp[e.v] = 0;
    DP(e.v, u);
  }
}
int blkc;
int minE[MAXN];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= m; i++) {
    int u, v, len;
    scanf("%d%d%d", &u, &v, &len);
    edge[i] = Edge(u, v, len, i);
  }
  Kruskal();
  for (int i = 1; i <= m; i++)
    if (edge[i].u == 1 || edge[i].v == 1) {
      int v = (edge[i].u != 1 ? edge[i].u : edge[i].v);
      int r = Root(v);
      if (minE[r] == 0) {
        blkc++;
        minE[r] = i;
      }
    }
  if (blkc > k) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i <= n; i++)
    if (minE[i] != 0) {
      AddEdge(minE[i]);
      use[minE[i]] = true;
    }
  for (int i = blkc + 1; i <= k; i++) {
    DP(1);
    int best = 0x3F3F3F3F, e, e1;
    for (int j = 1; j <= m; j++)
      if (!use[j] && (edge[j].u == 1 || edge[j].v == 1)) {
        int v = (edge[j].u != 1 ? edge[j].u : edge[j].v);
        if (best > edge[j].len - dp[v]) {
          best = edge[j].len - dp[v];
          e = dpid[v];
          e1 = j;
        }
      }
    AddEdge(e1);
    use[e1] = true;
    use[e] = false;
  }
  printf("%d\n", n - 1);
  for (int i = 1; i <= m; i++)
    if (use[i]) printf("%d ", edge[i].id);
  puts("");
  return 0;
}