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 = 5010;
const int MAXM = 100010;
const int INF = ~0U >> 2;
struct node {
  int a, b, w;
} e[MAXM];
struct Enode {
  int to, next;
} ee[MAXM * 2];
int n, m, k, box[MAXN], size;
int len[MAXN][MAXN];
int r[MAXN], rc;
int p[MAXN];
int dp[MAXN][3];
bool used[MAXN];
map<pair<int, int>, int> id;
bool operator<(const node &x, const node &y) { return x.w < y.w; }
int find_set(int x) {
  if (p[x] != x) p[x] = find_set(p[x]);
  return p[x];
}
void init() {
  scanf("%d%d%d", &n, &m, &k);
  rc = size = 0;
  memset(box, -1, sizeof(box));
  for (int i = 0, a, b, w; i < m; ++i) {
    scanf("%d%d%d", &a, &b, &w);
    e[i].a = a, e[i].b = b, e[i].w = w;
    len[a][b] = len[b][a] = w;
    id[make_pair(a, b)] = id[make_pair(b, a)] = i + 1;
    if (a == 1) r[rc++] = b;
    if (b == 1) r[rc++] = a;
  }
}
void add(int from, int to) {
  ee[size].to = to;
  ee[size].next = box[from];
  box[from] = size++;
  ee[size].to = from;
  ee[size].next = box[to];
  box[to] = size++;
}
void del(int from, int to) {
  if (box[from] == -1) return;
  if (ee[box[from]].to == to) {
    box[from] = ee[box[from]].next;
    return;
  }
  for (int i = box[from]; ~i; i = ee[i].next) {
    if (ee[ee[i].next].to == to) {
      ee[i].next = ee[ee[i].next].next;
      break;
    }
  }
}
int MDMST() {
  sort(e, e + m);
  for (int i = 1; i <= n; ++i) p[i] = i;
  for (int i = 0; i < m; ++i) {
    if (e[i].a == 1 || e[i].b == 1) continue;
    int a = find_set(e[i].a), b = find_set(e[i].b);
    if (a != b) p[a] = b, add(e[i].a, e[i].b);
  }
  int s = 0;
  for (int i = 2; i <= n; ++i)
    if (p[i] == i) s++;
  for (int i = 0; i < m; ++i) {
    if (e[i].a != 1 && e[i].b != 1) continue;
    int a = find_set(e[i].a), b = find_set(e[i].b);
    if (a != b) p[a] = b, add(e[i].a, e[i].b);
  }
  memset(used, false, sizeof(used));
  for (int i = box[1]; ~i; i = ee[i].next) used[ee[i].to] = true;
  return s;
}
void DP(int x, int father) {
  for (int i = box[x]; ~i; i = ee[i].next)
    if (ee[i].to != father) {
      if (len[x][ee[i].to] > dp[x][0]) {
        dp[ee[i].to][0] = len[x][ee[i].to];
        dp[ee[i].to][1] = x;
        dp[ee[i].to][2] = ee[i].to;
      } else {
        dp[ee[i].to][0] = dp[x][0];
        dp[ee[i].to][1] = dp[x][1];
        dp[ee[i].to][2] = dp[x][2];
      }
      DP(ee[i].to, x);
    }
}
void inc_deg() {
  memset(dp, -1, sizeof(dp));
  for (int i = box[1]; ~i; i = ee[i].next) DP(ee[i].to, 1);
  int id, mn = INF, i1, i2;
  for (int i = 0; i < rc; ++i)
    if (!used[r[i]] && len[1][r[i]] - dp[r[i]][0] < mn) {
      mn = len[1][r[i]] - dp[r[i]][0];
      id = r[i];
      i1 = dp[r[i]][1], i2 = dp[r[i]][2];
    }
  add(1, id);
  used[id] = true;
  del(i1, i2), del(i2, i1);
}
void KDMST() {
  int M = MDMST();
  if (k < M || k > rc) {
    puts("-1");
    return;
  }
  for (int i = 0; i < k - M; ++i) inc_deg();
  printf("%d\n", n - 1);
  for (int i = 1; i <= n; ++i)
    for (int j = box[i]; ~j; j = ee[j].next)
      if (i < ee[j].to) printf("%d ", id[make_pair(i, ee[j].to)]);
  printf("\n");
}
int main() {
  init();
  KDMST();
  return 0;
}