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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        EAAndBAndLectureRooms solver = new EAAndBAndLectureRooms();
        solver.solve(1, in, out);
        out.close();
    }

    static class EAAndBAndLectureRooms {
        ArrayList<Integer>[] arrayList;
        int D;
        int[] depth;
        int[][] dp;
        int[] size;

        void DFS(int s, int p) {
            size[s] = 1;
            for (int tt : arrayList[s]) {
                if (tt != p) {
                    DFS(tt, s);
                    size[s] += size[tt];
                }
            }
        }

        int walk(int i, int k) {
            for (int d = 0; d <= D && i != -1; d++) {
                if (((1 << d) & k) > 0) {
                    i = dp[d][i];
                }
            }
            return i;
        }

        int lca(int i, int j) {
            if (depth[i] > depth[j])
                i = walk(i, depth[i] - depth[j]);
            if (depth[j] > depth[i])
                j = walk(j, depth[j] - depth[i]);
            if (i == j)
                return i;


            for (int d = D; d >= 0; d--) {
                if (dp[d][i] != dp[d][j]) {
                    i = dp[d][i];
                    j = dp[d][j];
                }
            }
            return dp[0][i];
        }

        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            arrayList = new ArrayList[n + 1];
            for (int i = 0; i <= n; i++) {
                arrayList[i] = new ArrayList<>();
            }

            for (int i = 1; i < n; i++) {
                int a = in.scanInt();
                int b = in.scanInt();
                arrayList[a].add(b);
                arrayList[b].add(a);
            }


            D = (int) Math.ceil((double) Math.log(n) / Math.log(2)) + 1;
            dp = new int[D + 1][n + 1];
            for (int[] dd : dp) Arrays.fill(dd, -1);

            ArrayDeque<Integer> q = new ArrayDeque<>();
            boolean visited[] = new boolean[n + 1];
            size = new int[n + 1];
            depth = new int[n + 1];

            q.add(1);
            visited[1] = true;

            while (q.size() > 0) {
                int i = q.poll();
                for (int tt : arrayList[i]) {
                    if (!visited[tt]) {
                        visited[tt] = true;
                        q.add(tt);
                        dp[0][tt] = i;
                        depth[tt] = depth[i] + 1;
                    }
                }
            }
            for (int k = 1; k <= D; k++) {
                for (int i = 0; i <= n; i++) {
                    int mid = dp[k - 1][i];
                    if (mid != -1) {
                        dp[k][i] = dp[k - 1][mid];
                    }
                }
            }

            DFS(1, -1);

            int qq = in.scanInt();
            while (qq-- > 0) {
                int a = in.scanInt();
                int b = in.scanInt();
                int lca = lca(a, b);
                if (a == b) {
                    out.println(n);
                    continue;
                }
                if (dist(a, b) % 2 == 0) {
                    if (dist(a, lca) == dist(b, lca))
                        out.println((long) n - size[walk(a, dist(a, lca) - 1)] - size[walk(b, dist(b, lca) - 1)]);
                    else {
                        if (depth[a] > depth[b]) {
                            int p1 = walk(a, dist(a, b) / 2);
                            int p2 = walk(a, (dist(a, b) / 2) - 1);
                            out.println(size[p1] - size[p2]);
                        } else {
                            int p1 = walk(b, dist(a, b) / 2);
                            int p2 = walk(b, (dist(a, b) / 2) - 1);
                            out.println(size[p1] - size[p2]);
                        }
                    }
                } else {
                    out.println(0);
                }

            }
        }

        int dist(int a, int b) {
            return depth[a] + depth[b] - (2 * depth[lca(a, b)]);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public int scanInt() {
            int I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}

