#Q132. 「一本通 4.4 例 1」点的距离
「一本通 4.4 例 1」点的距离
Description
Given a tree with nodes, answer queries. Each query asks for the distance between two nodes and .
Input Format
The first line contains a positive integer , indicating the number of nodes in the tree;
Next, lines follow, each with two integers and , indicating an edge between nodes and ;
Then an integer , representing the number of queries;
Finally, lines follow, each with two integers and , representing a query for the distance between and .
Output Format
Output lines, each containing the answer to the corresponding query.
Sample 1
6
1 2
1 3
2 4
2 5
3 6
2
2 6
5 6
3
4
Constraints and Hints
For all data, .