519_E. A and B and Lecture Rooms
A 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 ≤ 105) — 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 ai and bi (1 ≤ ai, bi ≤ n), showing that the i-th corridor connects rooms ai and bi.

The next line contains integer m (1 ≤ m ≤ 105) — the number of queries.

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

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.
```python
from collections import defaultdict as df
from collections import deque
import os
import sys
from io import BytesIO, IOBase

_str = str
str = lambda x=b"": x if type(x) is bytes else _str(x).encode()

BUFSIZE = 8192
from types import GeneratorType


def bootstrap(f, stack=[]):
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to

    return wrappedfunc

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
import math
timer = [0]


@bootstrap
def dfs(v, p):
    tin[v] = timer[0]
    timer[0] += 1
    up[v][0] = p
    for i in range(1, L):
        up[v][i] = up[up[v][i - 1]][i - 1]

    for child in tree[v]:
        if child != p:
            depth[child] = depth[v] + 1
            yield dfs(child, v)
            sz[v] += sz[child]
    sz[v] += 1

    tout[v] = timer[0]
    timer[0] += 1
    yield 0


def is_ancestor(u, v):
    return tin[u] <= tin[v] and tout[u] >= tout[v]


def lca(u, v):
    if is_ancestor(u, v):
        return u
    if is_ancestor(v, u):
        return v
    for i in range(L - 1, -1, -1):
        if not is_ancestor(up[u][i], v):
            u = up[u][i]
    return up[u][0]

def cal_node(u, step):
    for i in range(L - 1, -1, -1):

        if pows[i] > step:
            continue
        # print('result dis: {}'.format(res))
        # input()
        u = up[u][i]
        step -= pows[i]
    return u


n = int(input())
depth = [0 for i in range(n + 1)]
L = math.ceil(math.log2(n) + 1)
pows = [2**i for i in range(L + 1)]
tin = [0 for i in range(n + 1)]
tout = [0 for i in range(n + 1)]
sz = [0 for i in range(n + 1)]
up = [[0 for i in range(L)] for i in range(n + 1)]
tree = df(list)
for i in range(n - 1):
    u, v = map(int, input().split())
    tree[u].append(v)
    tree[v].append(u)

dfs(1, 1)

m = int(input())
for _ in range(m):
    a,b = map(int, input().split())
    if a == b:
        print(sz[1])
    elif is_ancestor(a,b):
        dis = abs(depth[a] - depth[b])
        if dis % 2:
            print(0)
        else:
            ans_node = cal_node(b, dis//2 - 1)
            ans_sz = sz[ans_node]
            pa_sz = sz[up[ans_node][0]]
            print(pa_sz - ans_sz)
    elif is_ancestor(b, a):
        dis = abs(depth[b] - depth[a])
        if dis % 2:
            print(0)
        else:
            ans_node = cal_node(a, dis // 2 - 1)
            ans_sz = sz[ans_node]
            pa_sz = sz[up[ans_node][0]]
            print(pa_sz - ans_sz)
    else:
        llca = lca(a, b)
        dis1 = abs(depth[llca] - depth[a])
        dis2 = abs(depth[llca] - depth[b])
        if (dis1 + dis2) % 2:
            print(0)
        elif dis1 == dis2:
            n1 = cal_node(a, dis1 - 1)
            n2 = cal_node(b, dis2 - 1)

            print(sz[1] - sz[n1] - sz[n2])
        else:
            if dis1 > dis2:
                step_from_lca = (dis1 - dis2)//2
                step_to_lca = dis1 - step_from_lca
                node = cal_node(a, step_to_lca - 1)
                pa_sz = sz[up[node][0]]
                print(pa_sz - sz[node])
            else:
                step_from_lca = (dis2 - dis1) // 2
                step_to_lca = dis2 - step_from_lca
                node = cal_node(b, step_to_lca - 1)
                pa_sz = sz[up[node][0]]
                print(pa_sz - sz[node])


```