Panda loves taking people to programming tour. He loves to take tourists from one camp to another and teach them different algorithms. Some two-way roads connect the cities. For each pair of neighboring camps there is a bus service that runs only between those two cities and uses the road that directly connects them. Each bus service has a limit on the maximum number of passengers it can carry. Panda has a map showing the cities and the roads connecting them. He also has the information regarding each bus service. He understands that it may not always be possible for him to take all the tourists to the destination city in a single trip. It is guaranteed that you can reach any city from any other.
Help Panda find the minimum number of trips to take all his tourists to the destination city in the minimum number of trips.
Input Format:
The first line will contain two integers: N and M, representing respectively the number of cities and the number of road segments.
Then next M lines will each contain three integers: C1, C2 and P. C1, C2 are the city numbers, and P is the limit on the maximum number of passengers to be carried by the bus service between the two cities.
The next line will contain Q the number of queries.
Each query consists of three integers: S, D and T representing respectively the starting city, the destination city and the number of tourists to be guided.
Output Format:
For each query, output the minimum number of trips that will be required by Panda to take tourists from one camp to another.
If the Panda is unable to take tourists from one camp to another, output "-1" (without quotes).
Constraints:
2 <= N, Q <= 105
0 <= M <= 3*105
1 <= C1, C2 <= N
1 <= P <= 107
1 <= S, D <= N
0 <= T <= 109
Subtask 1:
2 <= N <= 5, Q = 100 - 5 points
Subtask 2:
Original constraints - 95 points