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.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

public class AAndBAndLecutreRooms {

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String[] splits;

        int n = Integer.parseInt(in.readLine());

        Graph corridors = new Graph(n);
        for (int i = 0; i < n - 1; i++) {
            splits = in.readLine().split(" ");
            corridors.addUndirectedEdge(Integer.parseInt(splits[0]) - 1, Integer.parseInt(splits[1]) - 1);
        }

        DFS dfs = new DFS(corridors.adj(), 0);
        LCA lca = new LCA(corridors.adj(), 0);

        int m = Integer.parseInt(in.readLine());
        while (m-- > 0) {
            splits = in.readLine().split(" ");
            int a = Integer.parseInt(splits[0]) - 1;
            int b = Integer.parseInt(splits[1]) - 1;

            if (a == b) {
                out.println(n);
                continue;
            }

            int c = lca.lca(a, b);

            int da = dfs.depth(a) - dfs.depth(c);
            int db = dfs.depth(b) - dfs.depth(c);

            if (da == db)
                out.println(n - dfs.count(lca.ancestor(a, da - 1)) - dfs.count(lca.ancestor(b, db - 1)));
            else {
                int d = da + db;
                if ((d & 1) != 0)
                    out.println(0);
                else {
                    d = (d + 1) / 2;
                    if (da < db)
                        out.println(dfs.count(lca.ancestor(b, d)) - dfs.count(lca.ancestor(b, d - 1)));
                    else
                        out.println(dfs.count(lca.ancestor(a, d)) - dfs.count(lca.ancestor(a, d - 1)));
                }
            }
        }
        out.flush();
    }

    @SuppressWarnings("unchecked")
    private static class Graph {

        private Collection<Integer>[] adj;

        public Graph(int N) {
            adj = (Collection<Integer>[]) new Collection[N];
            for (int i = 0; i < adj.length; i++)
                adj[i] = new ArrayList<>();
        }

        public void addDirectedEdge(int from, int to) {
            adj[from].add(to);
        }

        public void addUndirectedEdge(int v, int w) {
            addDirectedEdge(v, w);
            addDirectedEdge(w, v);
        }

        public Collection<Integer>[] adj() {
            return adj;
        }

        public Collection<Integer> adj(int v) {
            return adj[v];
        }

    }

    private static class DFS {

        private ArrayList<Integer> order;
        private int[] enter;
        private int[] exit;
        private int[] depth;

        public DFS(Collection<Integer>[] G, int s) {
            List<Integer> tmp = new ArrayList<>();
            tmp.add(s);
            dfs(G, tmp);
        }

        public DFS(Collection<Integer>[] G, List<Integer> S) {
            dfs(G, S);
        }

        private void dfs(Collection<Integer>[] G, List<Integer> S) {
            int N = G.length;

            order = new ArrayList<>();
            enter = new int[N];
            exit = new int[N];
            depth = new int[N];
            Arrays.fill(enter, -1);
            Arrays.fill(exit, -1);
            Arrays.fill(depth, Integer.MAX_VALUE);

            for (int s : S)
                dfs(s, 0, G);
        }

        public int count() {
            return order.size();
        }

        public boolean reachable(int v) {
            return enter[v] != -1;
        }

        public int enter(int v) {
            return enter[v];
        }

        public int exit(int v) {
            return exit[v];
        }

        public int depth(int v) {
            return depth[v];
        }

        public int count(int v) {
            return exit[v] - enter[v] + 1;
        }

        public ArrayList<Integer> order() {
            return order;
        }

        private void dfs(int v, int depth, Collection<Integer>[] G) {
            if (enter[v] != -1)
                return;

            enter[v] = order.size();
            this.depth[v] = depth;
            order.add(v);
            for (int w : G[v])
                dfs(w, depth + 1, G);
            exit[v] = order.size() - 1;
        }

    }

    private static class LCA {

        private int[] level;
        private int[][] DP;
        private int[] cc;

        public LCA(Collection<Integer>[] tree, int root) {
            Collection<Integer> tmp = new ArrayList<>();
            tmp.add(root);
            lca(tree, tmp);
        }

        public LCA(Collection<Integer>[] tree, Collection<Integer> roots) {
            lca(tree, roots);
        }

        private void lca(Collection<Integer>[] forest, Collection<Integer> roots) {
            int N = forest.length;

            int[] parent = new int[N];
            Arrays.fill(parent, -1);
            for (int root : roots)
                parent[root] = root;

            level = new int[N];
            cc = new int[N];

            for (int root : roots)
                dfs(root, parent, root, forest);

            int max = Integer.MIN_VALUE;
            for (int i = 0; i < N; i++)
                max = Math.max(max, level[i]);

            int log = log2(max) + 1;
            DP = new int[N][log + 1];

            for (int i = 0; i < N; i++)
                DP[i][0] = parent[i];

            for (int j = 1; j <= log; j++) {
                for (int i = 0; i < N; i++)
                    DP[i][j] = DP[DP[i][j-1]][j-1];
            }
        }

        private int lca(int v, int w) {
            if (cc[v] != cc[w])
                return -1;

            if (level[v] < level[w])
                return lca(w, v);

            int log = log2(level[v]);

            for (int i = log; i >= 0; i--) {
                if (level[DP[v][i]] >= level[w])
                    v = DP[v][i];
            }

            if (v == w)
                return v;

            for (int i = log; i >= 0; i--) {
                if (DP[v][i] != DP[w][i]) {
                    v = DP[v][i];
                    w = DP[w][i];
                }
            }

            return DP[v][0];
        }

        private int ancestor(int v, int i) {
            if (level[v] < i)
                return -1;
            i = level[v] - i;
            for (int j = log2(level[v]); j >= 0; j--) {
                if (level[DP[v][j]] >= i)
                    v = DP[v][j];
            }
            return v;
        }

        private void dfs(int v, int[] parent, int cc, Collection<Integer>[] G) {
            for (int w : G[v]) {
                if (parent[w] == -1) {
                    parent[w] = v;
                    level[w] = level[v] + 1;
                    this.cc[w] = cc;
                    dfs(w, parent, cc, G);
                }
            }
        }

        private static int log2(int x) {
            return x != 0 ? (int) Math.ceil(Math.log(x) / Math.log(2)) : 0;
        }

    }

}
