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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;

public class P519E {

    private static class Node {
        public final int id;
        public final int depth;
        public final Node[] ancestors;

        public int size = 1;

        public Node(int id, Node parent) {
            this.id = id;
            this.depth = (parent == null) ? 0 : parent.depth + 1;
            final List<Node> ancestors = new ArrayList<>();
            Node ancestor = parent;
            int i = 0;
            while (ancestor != null) {
                ancestors.add(ancestor);
                if (ancestor.ancestors.length > i) {
                    ancestor = ancestor.ancestors[i++];
                } else {
                    ancestor = null;
                }
            }
            this.ancestors = ancestors.toArray(new Node[0]);
        }

        public Node getAncestorAt(int depth) {
            if (depth > this.depth) {
                throw new IllegalArgumentException(
                    "depth must be <= this.depth");
            }
            Node node = this;
            while (depth < node.depth) {
                int i;
                for (i = 1; i < node.ancestors.length; i++) {
                    if (node.ancestors[i].depth < depth) {
                        break;
                    }
                }
                node = node.ancestors[i-1];
            }
            assert depth == node.depth;
            return node;
        }

        public Node getCommonAncestor(Node other) {
            Node a = this;
            Node b = other;
            if (a.depth > b.depth) {
                a = a.getAncestorAt(b.depth);
            } else {
                b = b.getAncestorAt(a.depth);
            }
            while (a != b) {
                int i;
                for (i = a.ancestors.length - 1; i > 0; i--) {
                    if (a.ancestors[i] != b.ancestors[i]) {
                        break;
                    }
                }
                a = a.ancestors[i];
                b = b.ancestors[i];
            }
            return a;
        }

        public String toString() {
            return "<" + (this.id + 1) + ": d=" + this.depth + " s="
                + this.size + ">";
        }
    }

    private static class IntPair {
        public final int x;
        public final int y;

        public IntPair(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    private static class Frame {
        public final Node node;
        public int step = 0;

        public Frame(Node node) {
            this.node = node;
        }
    }

    private static Node[] buildTree(int n, IntPair[] corridors) {
        final Node[] nodes = new Node[n];
        final List<List<Integer>> neighbors = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            neighbors.add(new ArrayList<>());
        }
        for (final IntPair corr : corridors) {
            neighbors.get(corr.x).add(corr.y);
            neighbors.get(corr.y).add(corr.x);
        }
        final Deque<Frame> stack = new ArrayDeque<>();
        nodes[0] = new Node(0, null);
        stack.addLast(new Frame(nodes[0]));
        while (!stack.isEmpty()) {
            final Frame frame = stack.getLast();
            if (frame.step == 0) {
                for (int id : neighbors.get(frame.node.id)) {
                    if (nodes[id] == null) {
                        nodes[id] = new Node(id, frame.node);
                        stack.addLast(new Frame(nodes[id]));
                    }
                }
                frame.step++;
            } else {
                if (frame.node.ancestors.length > 0) {
                    frame.node.ancestors[0].size += frame.node.size;
                }
                stack.removeLast();
            }
        }
        return nodes;
    }

    private static int[] rooms(int n, IntPair[] corridors,
                               int m, IntPair[] queries) {
        final Node[] nodes =  buildTree(n, corridors);
        final int[] results = new int[m];
        int i = 0;
        for (final IntPair query : queries) {
            if (query.x == query.y) {
                results[i++] = n;
                continue;
            }
            final Node x;
            final Node y;
            if (nodes[query.x].depth >= nodes[query.y].depth) {
                x = nodes[query.x];
                y = nodes[query.y];
            } else {
                x = nodes[query.y];
                y = nodes[query.x];
            }
            if ((x.depth - y.depth) % 2 != 0) {
                results[i++] = 0;
                continue;
            }
            final Node z = x.getCommonAncestor(y);
            if (x.depth == y.depth) {
                final Node w1 = x.getAncestorAt(z.depth + 1);
                final Node w2 = y.getAncestorAt(z.depth + 1);
                results[i++] = n - w1.size - w2.size;
            } else {
                final int delta = (x.depth - z.depth + y.depth - z.depth) / 2;
                final Node w = x.getAncestorAt(x.depth - delta + 1);
                final Node v = w.ancestors[0];
                results[i++] = v.size - w.size;
            }
        }
        return results;
    }

    public static void main(String[] args) throws IOException {
        final BufferedReader in = new BufferedReader(
            new InputStreamReader(System.in));
        final int n = Integer.parseInt(in.readLine());
        final IntPair[] corridors = new IntPair[n-1];
        for (int i = 0; i < n-1; i++) {
            final String[] s = in.readLine().split(" ");
            final int x = Integer.parseInt(s[0]);
            final int y = Integer.parseInt(s[1]);
            corridors[i] = new IntPair(x-1, y-1);
        }
        final int m = Integer.parseInt(in.readLine());
        final IntPair[] queries = new IntPair[m];
        for (int i = 0; i < m; i++) {
            final String[] s = in.readLine().split(" ");
            final int x = Integer.parseInt(s[0]);
            final int y = Integer.parseInt(s[1]);
            queries[i] = new IntPair(x-1, y-1);
        }
        final int[] results = rooms(n, corridors, m, queries);
        final StringBuilder sb = new StringBuilder();
        for (int i : results) {
            sb.append(i).append('\n');
        }
        System.out.print(sb);
    }
}
