public static void main (String args[]) throws Exception {
		InputStreamReader reader;
		reader = new InputStreamReader(System.in);
		
		BufferedReader in = new BufferedReader(reader);
		
		// creating graph of 'n' vertices and 'm' as edges
		System.out.println("Enter the number of vertices in the graph: ");
		n = Integer.parseInt(in.readLine());
		
		System.out.println("Enter the number of edges in the graph: ");
		m = Integer.parseInt(in.readLine());
		
		path = new int[n+1];
		
		Edge e[] = new Edge[m];
		Edge t = new Edge();
		
		for ( i = 0; i < m; i++){
			e[i] = new Edge();
			//
			e[i].u = Integer.parseInt(in.readLine());
			// second vertex
			e[i].v = Integer.parseInt(in.readLine());
			// weight
			e[i].wt = Integer.parseInt(in.readLine());
		}
		
		// Sorting the edges in ascending order of weights
		for( i=0; i<=m-1; i++){
			for( j=0; i<m-1-i; j++){
				if(e[i].wt > e[j+1].wt)
					t = e[j];
					e[j] = e[j+1];
					e[j+1] = t;
			}
		}
	}