"Moutushi Enterprise" a leading transport company of Bangladesh is quite anxious about their current business status. For some recent months they aren't earning profitable money as they did before. They investigated over it and found that it is the change in the tax policy that caused them so. For this reason they want to reroute their ways and charge the passengers on the cost of that route.
The cost a bus has to bear is the cost of the oil it needs for that journey, along with some money paid on each station it touches. The profit is ten percent of the cost. Then the amount is divided by the total number of sits in the bus and the seat fare is then determined.
You are given the description of the city map, you are to determine the cheapest way of the map and the seat fare each passenger have to bear.
Input
The first line of the input indicates the number of map to process. Each map contains three sections. Section A contains the stations that the map contains. First line of this section is an integer nStation (0 < nStation < 20) indicating number of stations the path have. Next nStation line contains station name and the money that have to pay to pass through this station. Next section starts with an integer nPath (0 < nPath < 20) indicating number of paths that connects two stations. Next nPath contains station1 station2 distance, describing station1 has a path to station2 with distance equal to distance in kilometer and vice versa. Each kilometer costs an oil consumption of 2 taka (unit of money in Bangladesh). The third section consists of a integer nQuery (0 < nQuery < 10) with nQuery line of input. Each line have a query to follow in the format station1 station2 passenger, asking to find the best path from station1 to station2 and what will be the cost for each passenger for a bus with passenger amount of seat. It is guaranteed that each map description is valid, and the query has a valid and unique path.