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 JAVA):

Solution:
// Don't place your source in a package
import javax.swing.*;
import java.lang.reflect.Array;
import java.text.DecimalFormat;
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
import java.util.stream.Stream;


// Please name your class Main
public class Main {
    static FastScanner fs=new FastScanner();
    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }
        int Int() {
            return Integer.parseInt(next());
        }

        long Long() {
            return Long.parseLong(next());
        }

        String Str(){
            return next();
        }
    }


    public static void main (String[] args) throws java.lang.Exception {
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        int T=1;
        for(int t=0;t<T;t++){
            int n=Int(),m=Int(),k=Int();
            int A[][]=new int[m][4];
            int cnt=0;
            for(int i=0;i<m;i++){
                int u=Int()-1,v=Int()-1,w=Int();
                A[i][0]=u;A[i][1]=v;
                A[i][2]=w;A[i][3]=i;
                if(u==0||v==0)cnt++;
            }

            if(cnt<k){
                out.println(-1);out.close();
                return;
            }
            if(n>1&&k==0){
                out.println(-1);out.close();
                return;
            }

            Solution sol=new Solution(out);
            sol.solution(n,A,k);
        }
        out.close();

    }


    public static int Int(){
        return fs.Int();
    }
    public static long Long(){
        return fs.Long();
    }
    public static String Str(){
        return fs.Str();
    }

}








class Solution{
    PrintWriter out;
    public Solution(PrintWriter out){
        this.out=out;
    }


    int nums[];
    public void solution(int n,int A[][],int k){
        nums=new int[n];
        int l=-1000000,r=1000000;
        List<Integer>res=new ArrayList<>();
        int pos=-1;
        while(l<=r){
            int mid=l+(r-l)/2;
            for(int i=0;i<A.length;i++){
                if(A[i][0]==0||A[i][1]==0)A[i][2]+=mid;
            }
            Arrays.sort(A,(a,b)->{
                return a[2]-b[2];
            });
            for(int i=0;i<nums.length;i++){
                nums[i]=i;
            }



            int cnt=0;
            List<Integer>list=new ArrayList<>();
            for(int p[]:A){
                int u=p[0],v=p[1];
                int r1=find(u);int r2=find(v);
                if(r1!=r2){
                    if(u==0||v==0)cnt++;
                    nums[r1]=r2;
                    list.add(p[3]);
                }
            }

            //System.out.println(cnt+"      "+l+" "+r+" "+mid);
            if(cnt>=k){
                if(cnt==k)res=list;
                pos=mid;
                l=mid+1;
            }
            else{//not enough k
                r=mid-1;
            }

            for(int i=0;i<A.length;i++){
                if(A[i][0]==0||A[i][1]==0)A[i][2]-=mid;
            }
        }


        if(res.size()==0){
            int cnt=0;
            int mid=pos;
            for(int i=0;i<nums.length;i++){
                nums[i]=i;
            }
            for(int i=0;i<A.length;i++){
                if(A[i][0]==0||A[i][1]==0)A[i][2]+=mid;
            }
            Arrays.sort(A,(a,b)->{
                return a[2]-b[2];
            });

            for(int p[]:A){
                int u=p[0],v=p[1];
                int r1=find(u);int r2=find(v);
                if(r1!=r2){
                    if(u==0||v==0){
                        if(cnt==k)continue;
                        cnt++;
                    }
                    nums[r1]=r2;
                    res.add(p[3]);
                }
            }
        }


        out.println(res.size());
        for(int i:res){
            out.print((i+1)+" ");
        }

    }


    public int find(int x){
        if(nums[x]==x)return x;
        int root=find(nums[x]);
        nums[x]=root;
        return root;
    }

}