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;
int whi[5010];
int fat[5010];
set<pair<int, int> > edges[5010];
vector<pair<int, pair<int, int> > > mel;
vector<int> edgeList, remEdges;
set<int> rem, ans;
void DFS(int v, int mxDist, int f) {
  if (v == 1) {
    for (set<pair<int, int> >::iterator it = edges[v].begin();
         it != edges[v].end(); it++)
      if (it->first != f) DFS(it->first, -1, 1);
    return;
  }
  whi[v] = mxDist;
  for (set<pair<int, int> >::iterator it = edges[v].begin();
       it != edges[v].end(); it++)
    if (it->first != f) {
      if (mxDist == -1 || mel[it->second].first > mel[mxDist].first)
        DFS(it->first, it->second, v);
      else
        DFS(it->first, mxDist, v);
    }
}
bool cmp(int a, int b) { return mel[a] < mel[b]; }
int parent(int x) { return (fat[x] == x ? x : fat[x] = parent(fat[x])); }
bool mrg(int a, int b) {
  a = parent(a);
  b = parent(b);
  if (a == b) return false;
  fat[a] = b;
  return true;
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) fat[i] = i;
  for (int i = 0; i < m; i++) {
    int u, v, l;
    cin >> u >> v >> l;
    if (v == 1) swap(u, v);
    mel.push_back(pair<int, pair<int, int> >(l, pair<int, int>(u, v)));
    if (u != 1 && v != 1)
      edgeList.push_back(i);
    else
      remEdges.push_back(i);
  }
  sort(edgeList.begin(), edgeList.end(), cmp);
  int pe = 0;
  for (int i = 0; i < edgeList.size(); i++)
    if (mrg(mel[edgeList[i]].second.first, mel[edgeList[i]].second.second)) {
      int u = mel[edgeList[i]].second.first;
      int v = mel[edgeList[i]].second.second;
      edges[u].insert(pair<int, int>(v, edgeList[i]));
      edges[v].insert(pair<int, int>(u, edgeList[i]));
      ans.insert(edgeList[i]);
      pe++;
    }
  sort(remEdges.begin(), remEdges.end(), cmp);
  for (int i = 0; i < remEdges.size(); i++)
    if (mrg(1, mel[remEdges[i]].second.second)) {
      int u = 1;
      int v = mel[remEdges[i]].second.second;
      edges[u].insert(pair<int, int>(v, remEdges[i]));
      edges[v].insert(pair<int, int>(u, remEdges[i]));
      ans.insert(remEdges[i]);
      pe++;
      k--;
    } else
      rem.insert(remEdges[i]);
  if (pe < n - 1 || k < 0 || rem.size() < k) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < k; i++) {
    DFS(1, -1, -1);
    int ansT = 1000000000, ansi = -1;
    for (set<int>::iterator it = rem.begin(); it != rem.end(); it++) {
      if (ansT > mel[*it].first - mel[whi[mel[*it].second.second]].first) {
        ansT = mel[*it].first - mel[whi[mel[*it].second.second]].first;
        ansi = *it;
      }
    }
    rem.erase(ansi);
    int v = mel[ansi].second.second;
    int e = whi[v];
    int x = mel[e].second.first, y = mel[e].second.second;
    edges[x].erase(pair<int, int>(y, e));
    edges[y].erase(pair<int, int>(x, e));
    edges[1].insert(pair<int, int>(v, ansi));
    edges[v].insert(pair<int, int>(1, ansi));
    ans.erase(e);
    ans.insert(ansi);
  }
  cout << ans.size() << endl;
  for (set<int>::iterator it = ans.begin(); it != ans.end(); it++)
    cout << *it + 1 << " ";
}