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.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;

import static java.lang.Math.*;

public class Main {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        if (ONLINE_JUDGE) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    public static void main(String[] args) {
        new Main().run();
        // Sworn to fight and die
    }

    public static void mergeSort(int[] a) {
        mergeSort(a, 0, a.length - 1);
    }

    private static void mergeSort(int[] a, int levtIndex, int rightIndex) {
        final int MAGIC_VALUE = 50;
        if (levtIndex < rightIndex) {
            if (rightIndex - levtIndex <= MAGIC_VALUE) {
                insertionSort(a, levtIndex, rightIndex);
            } else {
                int middleIndex = (levtIndex + rightIndex) / 2;
                mergeSort(a, levtIndex, middleIndex);
                mergeSort(a, middleIndex + 1, rightIndex);
                merge(a, levtIndex, middleIndex, rightIndex);
            }
        }
    }

    private static void merge(int[] a, int levtIndex, int middleIndex,
                              int rightIndex) {
        int length1 = middleIndex - levtIndex + 1;
        int length2 = rightIndex - middleIndex;
        int[] levtArray = new int[length1];
        int[] rightArray = new int[length2];
        System.arraycopy(a, levtIndex, levtArray, 0, length1);
        System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
        for (int k = levtIndex, i = 0, j = 0; k <= rightIndex; k++) {
            if (i == length1) {
                a[k] = rightArray[j++];
            } else if (j == length2) {
                a[k] = levtArray[i++];
            } else {
                a[k] = levtArray[i] <= rightArray[j] ? levtArray[i++]
                        : rightArray[j++];
            }
        }
    }

    private static void insertionSort(int[] a, int levtIndex, int rightIndex) {
        for (int i = levtIndex + 1; i <= rightIndex; i++) {
            int current = a[i];
            int j = i - 1;
            while (j >= levtIndex && a[j] > current) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = current;
        }
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }



    class LOL implements Comparable<LOL> {

        int x;
        int y;



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

        }

        @Override
        public int compareTo(LOL o) {

            return (x - o.x); // ---->
            //return o.x * o.y - x * y; // <----
        }

    }

    class LOL2 implements Comparable<LOL2> {

        int x;
        int y;
        int z;



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

        @Override
        public int compareTo(LOL2 o) {

            return (z - o.z); // ---->
            //return o.x * o.y - x * y; // <----
        }

    }

    class test implements Comparable<test> {

        long x;
        long y;



        public test(long x, long y) {
            this.x = x;
            this.y = y;

        }

        @Override
        public int compareTo(test o) {
            //int compareResult = Long.compare(y, o.y); // ---->

            //if (compareResult != 0) {
            //    return -compareResult;
            //}

            int compareResult = Long.compare(x, o.x);

            if (compareResult != 0) {
                return compareResult;
            }

            return Long.compare(y, o.y);

            //return o.x * o.y - x * y; // <----
        }

    }

    class data {
        String name;
        String city;

        data(String name, String city) {
            this.city = city;
            this.name = name;
        }
    }

    class Point {
        double x;
        double y;


        Point(double x, double y) {
            this.x = x;
            this.y = y;

        }

        double distance(Point temp) {
            return Math.sqrt((x - temp.x) * (x - temp.x) + (y - temp.y) * (y - temp.y));
        }

        double sqrDist(Point temp) {
            return ((x - temp.x) * (x - temp.x) + (y - temp.y) * (y - temp.y));
        }

        Point rotate(double alpha) {
            return new Point(x * cos(alpha) - y * sin(alpha), x * sin(alpha) + y * cos(alpha));
        }

        void sum(Point o) {
            x += o.x;
            y += o.y;
        }

        void scalarProduct(int alpha) {
            x *= alpha;
            y *= alpha;
        }

    }

    class Line {
        double a;
        double b;
        double c;

        Line(Point A, Point B) {
            a = B.y - A.y;
            b = A.x - B.x;
            c = -A.x * a - A.y * b;
        }
        Line(double a, double b, double c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

      Point intersection(Line o) {
            double det = a * o.b - b * o.a;
            double det1 = -c * o.b + b * o.c;
            double det2 = -a * o.c + c * o.a;
            return new Point(det1 / det, det2 / det);
        }
    }

 /*   class Plane {
        double a;
        double b;
        double c;
        double d;

        Plane (Point fir, Point sec, Point thi) {
            double del1 = (sec.y - fir.y) * (thi.z - fir.z) - (thi.y - fir.y) * (sec.z - fir.z);
            double del2 = (thi.x - fir.x) * (sec.z - fir.z) - (thi.z - fir.z) * (sec.x - fir.x);
            double del3 = (thi.y - fir.y) * (sec.x - fir.x) - (thi.x - fir.x) * (sec.y - fir.y);
            a = del1;
            b = del2;
            c = del3;
            d = -fir.x * del1 - fir.y * del2 - fir.z * del3;
        }

        double distance(Point point) {
            return abs(a * point.x + b * point.y + c * point.z + d) / sqrt(a * a + b * b + c * c);
        }


    } */

    class record implements Comparable<record> {
        String city;
        Long score;

        public record(String name, Long score) {
            this.city = name;
            this.score = score;
        }

        @Override
        public int compareTo(record o) {
            if (o.city.equals(city)) {
                return 0;
            }

            if (score.equals(o.score)) {
                return 1;
            }

            if (score > o.score) {
                return 666;
            } else {
                return -666;
            }

            //return Long.compare(score, o.score);

        }

    }

    public long gcd(long a, long b) {
        if (a == 0 || b == 0) return max(a, b);

        if (a % b == 0)
            return b;
        else
            return gcd(b, a % b);
    }

    boolean prime(long n) {
        if (n == 1) return false;
        for (int i = 2; i <= sqrt(n); i++)
            if (n % i == 0)
                return false;
        return true;
    }

    public int sum(long n) {
        int s = 0;

        while (n > 0) {
            s += (n % 10);
            n /= 10;
        }

        return s;

    }

 /*   public void simulation(int k) {
        long ans = 0;
        int start = 1;
        for (int i = 0; i < k; i++) {
            start *= 10;
        }
        for (int i = start/10; i < start; i++) {
            int locAns = 0;
            for (int j = start/10; j < start; j++) {
                if  (sum(i + j) == sum(i) + sum(j) ) {
                    ans += 1;
                    locAns += 1;
                } else {
                    //.println(i + "!!!" + j);
                }
            }
            //out.println(i + " " + locAns);
        }
        out.println(ans);
    }*/




    ArrayList<Integer> primes;
    boolean[] isPrime;

    public void getPrimes (int n) {
        isPrime[0] = false;
        isPrime[1] = false;
        for (int i = 2; i <= n; i++) {
            if (isPrime[i]) {
                primes.add(i);
                if (1l * i * i <= n) {
                    for (int j = i * i; j <= n; j += i) {
                        isPrime[j] = false;
                    }
                }
            }
        }
    }




    public long binPowMod(long a, long b, long mod) {
        if (b == 0) {
            return 1 % mod;
        }

        if (b % 2 != 0) {
            return ((a % mod) * (binPowMod(a, b - 1, mod) % mod)) % mod;
        } else {
            long temp = binPowMod(a, b / 2, mod) % mod;
            long ans = (temp * temp) % mod;
            return ans;

        }
    }

    public long binPow(long a, long b) {
        if (b == 0) {
            return 1;
        }

        if (b % 2 != 0) {
            return a * binPow(a, b - 1);
        } else {
            long temp = binPow(a, b / 2);
            long ans = (temp * temp);
            return ans;

        }
    }


    boolean vis[];

    HashMap<Integer, HashSet<Integer>> g;
    int[] numOfComp;


    int p[];




    int find(int x) {
        if (x == p[x]) {
            return x;
        }

        return p[x] = find(p[x]);
    }

    boolean merge(int x, int y) {
        x = find(x);
        y = find(y);
        if (p[x] == p[y]) {
            return false;
        }
        p[y] = x;
        return true;
    }

    class Trajectory {
        double x0;
        double y0;
        double vx;
        double vy;


        Trajectory(double vx, double vy, double x0, double y0) {
            this.vx = vx;
            this.vy = vy;

            this.x0 = x0;
            this.y0 = y0;
        }

        double y (double x) {
            return y0 + (x - x0) * (vy / vx) - 5 * (x - x0) * (x - x0) / (vx * vx);
        }

        double der(double x) {
            return (vy / vx) - 10 * (x - x0) / (vx * vx);
        }


    }

    int[][] parent;
    int[] dist;

    int[] h;
    int[] sz;
    HashMap<String, Integer> weight;
    void dfs(int u, int prev) {
        vis[u] = true;
        parent[0][u] = prev;

        h[u] = h[prev] + 1;
        sz[u] = 1;
        for (Integer v: g.get(u)) {
            if (!vis[v]) {
                dfs(v, u);
                sz[u] += sz[v];
            }
        }
    }
    int n;

    int LCA(int x, int y) {

        if (h[x] < h[y]) {
            int temp = x;
            x = y;
            y = temp;
        }

        int dh = h[x] - h[y];
        int highest = 0;
        for (int i = 0; (1 << i) <= n + 1; i++) {
            if ((dh & (1 << i)) != 0) {
                x = parent[i][x];
            }
            highest = i;
        }

        if (x == y) {
            return x;
        }
        for (int i = highest; i >= 0; i--) {
            if (parent[i][x] != parent[i][y]) {
                x = parent[i][x];
                y = parent[i][y];
            }
        }



        return parent[0][x];
    }




    public void solve() throws IOException {

        n = readInt();
        g = new HashMap<Integer, HashSet<Integer>>();
        for (int i = 1; i <= n; i++) {
            g.put(i, new HashSet<Integer>());
        }
        dist = new int[n + 1];

        sz = new int[n + 1];
        int root = 1;
        for (int i = 0; i < n - 1; i++) {
            int u = readInt();
            int v = readInt();

            g.get(u).add(v);
            g.get(v).add(u);



            //temp = v + "-" + u;
            //weight.put(temp, w);
            //weight.put(new test(u, v), w);


        }

        parent = new int[20][n + 1];
        vis = new boolean[n + 1];
        h = new int[n + 1];


        dfs(root, root);

        for (int lvl = 1; (1 << lvl) <= n + 1; lvl++) {
            for (int x = 0; x < n + 1; x++) {
                parent[lvl][x] = parent[lvl - 1][parent[lvl - 1][x]];
            }
        }


        int m = readInt();

        for (int i = 0; i < m; i++) {
            int u = readInt();
            int v = readInt();
            int lca = LCA(u, v);

            if (h[u] == h[v]) {
                //int temp = sz[root] - sz[lca] + 1;
                //out.println(temp);
                int dist = h[u] + h[v] - 2 * h[lca] + 1;

                if (dist % 2 == 0) {
                    out.println(0);
                } else {

                    if (1 < 0) {

                    } else {
                        if (h[u] < h[v]) {
                            int temp = u;
                            u = v;
                            v = temp;
                        }
                        int dh = dist / 2;
                        int tempU = u;
                        for (int ind = 0; (1 << ind) <= n + 1; ind++) {
                            if ((dh & (1 << ind)) != 0) {
                                tempU = parent[ind][tempU];
                            }
                        }
                        int tempU2 = u;
                        dh = dist / 2 - 1;
                        for (int ind = 0; (1 << ind) <= n + 1; ind++) {
                            if ((dh & (1 << ind)) != 0) {
                                tempU2 = parent[ind][tempU2];
                            }
                        }

                        int ans = sz[root] - sz[tempU2];

                        tempU2 = v;
                        dh = dist / 2 - 1;
                        for (int ind = 0; (1 << ind) <= n + 1; ind++) {
                            if ((dh & (1 << ind)) != 0) {
                                tempU2 = parent[ind][tempU2];
                            }
                        }

                        ans -= sz[tempU2];
                        out.println(abs(ans));

                    }


                }
            } else {
                int dist = h[u] + h[v] - 2 * h[lca] + 1;

                if (dist % 2 == 0) {
                    out.println(0);
                } else {

                    if (1 < 0) {

                    } else {
                        if (h[u] < h[v]) {
                            int temp = u;
                            u = v;
                            v = temp;
                        }
                        int dh = dist / 2;
                        int tempU = u;
                        for (int ind = 0; (1 << ind) <= n + 1; ind++) {
                            if ((dh & (1 << ind)) != 0) {
                                tempU = parent[ind][tempU];
                            }
                        }
                        int tempU2 = u;
                        dh = dist / 2 - 1;
                        for (int ind = 0; (1 << ind) <= n + 1; ind++) {
                            if ((dh & (1 << ind)) != 0) {
                                tempU2 = parent[ind][tempU2];
                            }
                        }

                        int ans = sz[tempU] - sz[tempU2];
                        out.println(ans);


                    }


                }

            }

        }







    }



}