import java.util.*;
public class BigTruck{

	public static class Location implements Comparable<Location>{
		int numItems;
		LinkedList<Integer> edge = new LinkedList<Integer>();
		
	
		public Location(int numItems){
			this.numItems = numItems;
		}
		
	}	
	public static class Roads{
		int dist;
		Location A;
		Location B;
		public Roads(Location A,int dist, Location B){
			this.A = A;
			this.B = B;
			this.dist = dist;
		}
	}

	
	public void SolveTrip(Road[] roads, Location[] places){
		int[] bestDist = new int[places.length];
		int[] bestItem = new int[places.length];
		PriorityQueue<Location> queue = new PriorityQueue<Location>();



	}


	public static void main(String[] args){
		
		Scanner input = new Scanner(System.in);
		int numLocations = input.nextInt();
		//grab input
		Location[] places = new Location[numLocations];
		for (int i = 0; i<numLocations; i++){
			Location temp = new Location(input.nextInt());
			places[i] = temp;

		}
		Roads[] roads = new Roads[input.nextInt()];

		for (int i = 0; i<roads.length;i++){
			Roads temp = new Roads(input.nextInt(),input.nextInt(),input.nextInt());		
			roads[i] = temp;	 
		}
		SolveTrip(roads,places);		
		
		
		
		
	}




}
