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.
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        new Main().run(in, out);
        out.close();
    }

    void run(FastScanner in, PrintWriter out) {

        int n = in.nextInt();
        Set<Integer>[] adj = new Set[n];
        for (int i = 0; i < n; i++) adj[i] = new HashSet<>();

        for (int i = 1; i < n; i++) {
            int u = in.nextInt()-1;
            int v = in.nextInt()-1;
            adj[u].add(v);
            adj[v].add(u);
        }

        Node[] nodes = new Node[n];

        // root at node 0
        LinkedList<Integer> ll = new LinkedList<>();
        ll.add(0);
        nodes[0] = new Node(0, 0);
        int maxDepth = 0;
        while (!ll.isEmpty()) {
            int top = ll.pollFirst();
            for (Integer child : adj[top]) {
                ll.offerLast(child);
                nodes[child] = new Node(child, nodes[top].depth + 1);
                nodes[top].children.add(nodes[child]);
                adj[child].remove(top);
                maxDepth = Integer.max(maxDepth, nodes[child].depth);
            }
        }

        // construct jump table
        int K = Integer.numberOfTrailingZeros(Integer.highestOneBit(n)) + 1;

        Node[][] jumpTable = new Node[n][K];
        LinkedList<Node> l = new LinkedList<>();
        l.offer(nodes[0]);
        while (!l.isEmpty()) {
            Node top = l.pollFirst();
            for (Node child : top.children) {
                jumpTable[child.id][0] = top;
                l.offerLast(child);
            }

            Node halfNode = jumpTable[top.id][0];
            for (int k = 1; k < K; k++) {
                if (halfNode != null) {
                    jumpTable[top.id][k] = jumpTable[halfNode.id][k-1];
                    halfNode = jumpTable[top.id][k];
                }
            }
        }
        populateNumChildren(nodes[0]);

        // print jump table
        // for (int i = 0; i < n; i++) {
        //     System.out.print(i + " ");
        //     for (int k = 0; k < K; k++) {
        //         if (jumpTable[i][k] == null) System.out.print("null ");
        //         else System.out.print(jumpTable[i][k].id + " ");
        //     }
        //     System.out.println();
        // }

        int m = in.nextInt();
        for (int i = 0; i < m; i++) {
            int r1 = in.nextInt()-1;
            int r2 = in.nextInt()-1;
            if (r1 == r2) out.println(n);
            else if (nodes[r1].depth != nodes[r2].depth) {

                // if the distance between r1, r2 is even, there is no equidistant nodes
                // if it is odd, and the depths are not equal, walk d/2 up the lower node and
                // the number of equidistant rooms will be 1+number of child nodes of that node
                Node node1 = nodes[r1];
                Node node2 = nodes[r2];
                Node lca = lca(node1, node2, jumpTable);
                int dist = node1.depth + node2.depth - 2*lca.depth;
                if (dist%2 != 0) out.println(0);
                else {
                    if (node1.depth < node2.depth) {
                        // make node1 lower
                        Node temp = node1;
                        node1 = node2;
                        node2 = node1;
                    }
                    node1 = walk(node1, dist/2-1, jumpTable);
                    int numChildren = jumpTable[node1.id][0].numChildren + 1 - node1.numChildren - 1;
                    out.println(numChildren);
                }
            } else {
                // if the depths are equal,
                // the the equidistant nodes will be
                // n-(nodes in left subtree)-(nodes in right subtree)

                Node node1 = nodes[r1];
                Node node2 = nodes[r2];
                Node lca = lca(node1, node2, jumpTable);
                int dist = node1.depth + node2.depth - 2*lca.depth;
                int walkDist = dist/2-1;

                int total = n
                    - (walk(node1, walkDist, jumpTable).numChildren + 1)
                    - (walk(node2, walkDist, jumpTable).numChildren + 1);
                out.println(total);
            }
        }
    }

    void populateNumChildren(Node node) {
        int numChildren = 0;
        for (Node child : node.children) {
            populateNumChildren(child);
            numChildren += 1 + child.numChildren;
        }
        node.numChildren = numChildren;
    }

    Node walk(Node node, int d, Node[][] jumpTable) {
        Node currNode = node;
        for (int k = 0; k < jumpTable[0].length; k++) {
            if (((1<<k) & d) > 0 && currNode != null) {
                currNode = jumpTable[currNode.id][k];
            }
        }
        return currNode;
    }

    Node lca(Node node1, Node node2, Node[][] jumpTable) {
        if (node1.depth > node2.depth) {
            node1 = walk(node1, node1.depth - node2.depth, jumpTable);
        } else if (node1.depth < node2.depth) {
            node2 = walk(node2, node2.depth - node1.depth, jumpTable);
        }
        if (node1 == node2) return node1;

        for (int k = jumpTable[0].length - 1; k >= 0; k--) {
            if (jumpTable[node1.id][k] != jumpTable[node2.id][k]) {
                node1 = jumpTable[node1.id][k];
                node2 = jumpTable[node2.id][k];
            }
        }
        return jumpTable[node1.id][0];
    }

    class Node {
        int id;
        int depth;
        List<Node> children = new ArrayList<>();
        int numChildren;
        Node(int id, int depth) {
            this.id = id;
            this.depth = depth;
        }
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}