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

public class Main{
    final boolean isFileIO =  false;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");
    String delim = " ";

    public static void main(String[] args) throws IOException {
        Main m = new Main();
        m.initIO();
        m.solve();
        m.in.close();
        m.out.close();
    }

    public void initIO() throws IOException {
        if(!isFileIO) {
            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 nt() throws IOException {
        if(!st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken(delim);
    }

    String rl() throws IOException {
        return in.readLine();
    }

    int ni() throws IOException {
        return Integer.parseInt(nt());
    }

    long nl() throws IOException {
        return Long.parseLong(nt());
    }

    double nd() throws IOException {
        return Double.parseDouble(nt());
    }

    class Pair {
        public int x;
        public int y;

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

        public String toString() {
            return String.format("{%d, %d}", x, y);
        }
    }

    class SegmentTree {
        Pair[] a;
        int size;
        public SegmentTree(Pair[] b) {
            int n = b.length;
            int size = 1;
            while(size < n) {
                size <<= 1;
            }
            this.size = size;
            a = new Pair[size * 2 - 1];
            for(int i = size - 1; i < size - 1 + n; i++) {
                a[i] = b[i - (size - 1)];
            }
            for(int i = size - 1 + n; i < a.length; i++) {
                a[i] = new Pair(0, Integer.MAX_VALUE);
            }
            for(int i = size - 2; i >= 0; i--) {
                a[i] = (a[2 * i + 1].y < a[2 * i + 2].y ? a[2 * i + 1] : a[2 * i + 2]);
            }
        }

        public Pair getMin(int l, int r, int q_l, int q_r, int node) {
            if(q_l > q_r) {
                return new Pair(0, Integer.MAX_VALUE);
            }
            if(q_l == l && q_r == r) {
                return a[node];
            }
            int mid = l + (r - l) / 2;
            Pair first, second;
            first = getMin(l, mid, q_l, Math.min(mid, q_r), 2 * node + 1);
            second = getMin(mid + 1, r, Math.max(q_l, mid + 1), q_r, 2 * node + 2);
            if(first.y < second.y) {
                return first;
            } else {
                return second;
            }
        }
    }
    int time, closeTime;
    int[] h, children, first, close;
    Pair[] visit;
    boolean[] used;
    ArrayList<ArrayList<Integer>> g;
    ArrayList<ArrayList<Pair>> closeList;
    public void solve() throws IOException {
        int n = ni();
        g = new ArrayList<ArrayList<Integer>>();
        for(int i = 0; i < n; i++) {
            g.add(new ArrayList<Integer>());
        }
        used = new boolean[n];
        h = new int[n];
        first = new int[n];
        children = new int[n];
        visit = new Pair[2 * n - 1];
        close = new int[n];
        for(int i = 0; i < n - 1; i++) {
            int x, y;
            x = ni() - 1; y = ni() - 1;
            g.get(x).add(y);
            g.get(y).add(x);
        }
        dfs(0, 0);
        SegmentTree st = new SegmentTree(visit);
        closeList = new ArrayList<ArrayList<Pair>>();
        for(int i = 0; i < n; i++) {
            closeList.add(new ArrayList<Pair>());
        }
        for(int i = 0; i < n; i++) {
            closeList.get(h[i]).add(new Pair(i, close[i]));
        }
        Comparator<Pair> cmp = new Comparator<Pair>() {
            @Override
            public int compare(Pair o1, Pair o2) {
                if(o1.y < o2.y) {
                    return -1;
                }
                if(o1.y > o2.y) {
                    return 1;
                }
                return 0;
            }
        };
        for(int i = 0; i < n; i++) {
            Collections.sort(closeList.get(i), cmp);
        }
        int m = ni();
        for(int i = 0; i < m; i++) {
            int x, y;
            x = ni() - 1; y = ni() - 1;
            Pair lca = st.getMin(0, st.size - 1, Math.min(first[x], first[y]), Math.max(first[x], first[y]), 0);
            if(x == y) {
                out.println(n);
                continue;
            }
            if(h[x]== h[y]) {
                out.println(n - children[findClosest(x, lca.y + 1).x] - children[findClosest(y, lca.y + 1).x]);
            } else {
                int minV, maxV;
                if(h[x] < h[y]) {
                    maxV = x;
                    minV = y;
                } else {
                    maxV = y;
                    minV = x;
                }
                int dist = (h[maxV] - lca.y) + (h[minV] - lca.y);
                if(dist % 2 != 0) {
                    out.println(0);
                } else {
                    out.println(children[findClosest(minV, h[minV] - dist / 2).x] - children[findClosest(minV, h[minV] - dist / 2 + 1).x]);
                }
            }
        }
    }

    public Pair findClosest(int node, int height) {
        ArrayList<Pair> list = closeList.get(height);
        int left, right, mid;
        left = 0;
        right = list.size() - 1;
        while(left < right) {
            mid = left + (right - left) / 2;
            if(close[node] > list.get(mid).y) {
                left = mid + 1;
            } else {
                right = mid;
            }
        }
        return list.get(left);
    }

    public void dfs(int u, int height) {
        h[u] = height;
        used[u] = true;
        visit[time] = new Pair(u, height);
        first[u] = time++;
        for(int i = 0; i < g.get(u).size(); i++) {
            int v = g.get(u).get(i);
            if(!used[v]) {
                dfs(v, height + 1);
                visit[time++] = new Pair(u, height);
            }
        }
        for(int i = 0; i < g.get(u).size(); i++) {
            children[u] += children[g.get(u).get(i)];
        }
        children[u] += 1;
        close[u] = closeTime++;
    }
}

class Utils {

    public static long binpow(long a, long exp, long mod) {
        if(exp == 0) {
            return 1;
        }
        if(exp % 2 == 0) {
            long temp = binpow(a, exp / 2, mod);
            return (temp * temp) % mod;
        } else {
            return (binpow(a, exp - 1, mod) * a) % mod;
        }
    }

    public static long inv(long a, long mod) {
        return binpow(a, mod - 2, mod);
    }

    public static long addmod(long a, long b, long mod) {
        return ((a + b) % mod + mod) % mod;
    }

    public static long gcd(long a, long b) {
        if(b == 0)
            return a;
        return gcd(b, a % b);
    }

    //mul must be < 10^18
    public static long mulmod(long a, long b, long mod) {
        return (a * b + (((a * b) / mod) + 1) * mod) % mod;
    }
}