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:
import java.io.*;
import java.util.*;

public class KMST {
	
	final static int MAXN = 5001;
	final static int MAXM = 200001;
	
	int n, m, k, cntOut, ans;
	
	Edge[] e = new Edge[MAXM];
	Edge[] e2 = new Edge[MAXM];
	int[] cha = new int[MAXN];
	int[] out = new int[MAXN];
	
	class Edge implements Comparable<Edge> {
		int x, y, id;
		double c;
		
		public Edge(int x, int y, double c, int id) {
			this.x = x;
			this.y = y;
			this.c = c;
			this.id = id;
		}
		public int compareTo(Edge other) {
			if (this.c - other.c - 1e-10 < 0) return -1;
			if (this.c - other.c - 1e-10 > 0) return 1;
			return 0;
		}
		public Edge clone() {
			return new Edge(this.x, this.y, this.c, this.id);
		}
	}
	
	public void solve() throws IOException {
		n = nextInt();
		m = nextInt();
		k = nextInt();
		for (int i = 1; i <= m; i++) {
			int x, y, cost;
			x = nextInt();
			y = nextInt();
			cost = nextInt();
			if (x > y) {
				int tam = x;
				x = y;
				y = tam;
			}
			e[i] = new Edge(x, y, cost, i);
		}
		double l = -1000000000; 
		double r = 1000000000;
		while (l + 1e-10 < r) {
			double g = (l + r) / 2;
			if (count(g) >= k) l = g;
			else r = g;
		}
		//System.out.println(count(l) + " " + l);
		if (count(l) == k) {
			if (cntOut < n - 1) {
				System.out.println(-1);
				return;
			}
			System.out.println(cntOut);
			for (int i = 1; i <= cntOut; i++)
				System.out.print(out[i]+ " ");
		}
		else
			System.out.println(-1);
	}
	
	final private int count(double v) {
		int ans = 0;
		for (int i = 1; i <= m; i++) {
			e2[i] = e[i].clone();
			if (e2[i].x == 1) e2[i].c += v;
		}
		//for (int i = 1; i <= m; i++)
			//System.out.println(v + " " + e2[i].x + " " + e2[i].y + " " + e2[i].c + " " + e[i].c);
		Arrays.sort(e2, 1, m + 1);
		for (int i = 1; i <= n; i++)
			cha[i] = i;
		cntOut = 0;
		for (int i = 1; i <= m; i++) {
			int cha1 = find(e2[i].x);
			int cha2 = find(e2[i].y);
			if (cha1 != cha2) {
				cha[cha2] = cha1;
				if (e2[i].x == 1) ans++;
				out[++cntOut] = e2[i].id;
			}
		}
		return ans;
	}
	
	final private int find(int x) {
		if (cha[x] == x) return x;
		cha[x] = find(cha[x]);
		return cha[x];
	}
	
	
	public static void main(String[] args) throws FileNotFoundException {
		new KMST().run();
	}

	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;

	public void run() {
		try {
			long tbegin = System.currentTimeMillis();
			reader = new BufferedReader(new InputStreamReader(System.in));
			//reader = new BufferedReader(new InputStreamReader(new FileInputStream("fselect.inp")));
			tokenizer = null;
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
					System.out)));
			//writer = new PrintWriter(new FileOutputStream("fselect.out"));
			solve();
			//System.out.println(System.currentTimeMillis() - tbegin + "ms...");
			writer.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

}