Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

E. A and B and Lecture Rooms

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputA and B are preparing themselves for programming contests.

The University where A and B study is a set of rooms connected by corridors. Overall, the University has *n* rooms connected by *n* - 1 corridors so that you can get from any room to any other one by moving along the corridors. The rooms are numbered from 1 to *n*.

Every day А and B write contests in some rooms of their university, and after each contest they gather together in the same room and discuss problems. A and B want the distance from the rooms where problems are discussed to the rooms where contests are written to be equal. The distance between two rooms is the number of edges on the shortest path between them.

As they write contests in new rooms every day, they asked you to help them find the number of possible rooms to discuss problems for each of the following *m* days.

Input

The first line contains integer *n* (1 ≤ *n* ≤ 10^{5}) — the number of rooms in the University.

The next *n* - 1 lines describe the corridors. The *i*-th of these lines (1 ≤ *i* ≤ *n* - 1) contains two integers *a*_{i} and *b*_{i} (1 ≤ *a*_{i}, *b*_{i} ≤ *n*), showing that the *i*-th corridor connects rooms *a*_{i} and *b*_{i}.

The next line contains integer *m* (1 ≤ *m* ≤ 10^{5}) — the number of queries.

Next *m* lines describe the queries. The *j*-th of these lines (1 ≤ *j* ≤ *m*) contains two integers *x*_{j} and *y*_{j} (1 ≤ *x*_{j}, *y*_{j} ≤ *n*) that means that on the *j*-th day A will write the contest in the room *x*_{j}, B will write in the room *y*_{j}.

Output

In the *i*-th (1 ≤ *i* ≤ *m*) line print the number of rooms that are equidistant from the rooms where A and B write contest on the *i*-th day.

Examples

Input

4

1 2

1 3

2 4

1

2 3

Output

1

Input

4

1 2

2 3

2 4

2

1 2

1 3

Output

0

2

Note

in the first sample there is only one room at the same distance from rooms number 2 and 3 — room number 1.

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/22/2017 22:16:00 (c4).

Desktop version, switch to mobile version.

User lists

Name |
---|