A weighted tree is given. Find the distance between two specified vertices.
The first line contains the number of nodes in the tree. Nodes are numbered from to . Each of the following lines consists of three integers representing an edge with weight , connecting nodes and . The next line contains the number of queries . Each of the next lines contains two integers — the numbers of vertices between which the distance needs to be computed.
For each query print the distance between the nodes with the given numbers.