#Q132. 「一本通 4.4 例 1」点的距离

「一本通 4.4 例 1」点的距离

Description

Given a tree with nn nodes, answer QQ queries. Each query asks for the distance between two nodes xx and yy.

Input Format

The first line contains a positive integer nn, indicating the number of nodes in the tree;

Next, n1n-1 lines follow, each with two integers xx and yy, indicating an edge between nodes xx and yy;

Then an integer QQ, representing the number of queries;

Finally, QQ lines follow, each with two integers xx and yy, representing a query for the distance between xx and yy.

Output Format

Output QQ 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, 1n105,1x,yn1\le n\le 10^5,1\le x,y\le n.