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.util.ArrayList;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

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

class TaskE {
    
    LcaComputer lcaComputer;
    
    int getSolution(int a, int b) {
        if (a == b)
            return lcaComputer.getVertexCount();
        int lca = lcaComputer.getLca(a, b);
        int[] height = lcaComputer.getDepths();
        int[] size = lcaComputer.getSubtreeSizes();
        int dist = height[a] + height[b] - 2 * height[lca];
        if (dist % 2 == 1)
            return 0;
        if (height[a] < height[b]) {
            int t = a;
            a = b;
            b = t;
        }
        if (height[a] == height[b]) {
            int d1 = height[a] - height[lca];
            int ancA = lcaComputer.getAncestorByDepth(a, d1 - 1);
            int ancB = lcaComputer.getAncestorByDepth(b, d1 - 1);
            return lcaComputer.getVertexCount() - size[ancA] - size[ancB];
        } else {
            int d1 = dist / 2;
            int ancA = lcaComputer.getAncestorByDepth(a, d1);
            int ancLow = lcaComputer.getAncestorByDepth(a, d1 - 1);
            return size[ancA] - size[ancLow];
        }
    }

    public void solve(int testNumber, FastScanner in, PrintWriter out) {
        int n = in.nextInt();
        ArrayList<Integer>[] g = new ArrayList[n];
        for (int i = 0; i < n; i++)
            g[i] = new ArrayList<>();
        for (int i = 0; i < n - 1; i++) {
            int a = in.nextInt();
            int b = in.nextInt();
            a--;
            b--;
            g[a].add(b);
            g[b].add(a);
        }
        lcaComputer = new LcaComputer(g);
        int m = in.nextInt();
        for (int i = 0; i < m; i++) {
            int a = in.nextInt();
            int b = in.nextInt();
            a--;
            b--;
            out.println(getSolution(a, b));
        }
    }
}

class LcaComputer {

    private int LOG;
    private final ArrayList<Integer>[] g;
    private int[][] ancestorAtDepth;
    private int[] timeIn;
    private int[] timeOut;
    private int[] depth;
    private int[] subtreeSize;
    private boolean[] used;
    private int timer;
    private int vertexCount;
    private int root;
    
    public LcaComputer(ArrayList<Integer>[] g, int root) {
        this.g = g;
        this.root = root;
        vertexCount = g.length;
        LOG = 10;
        while ((1 << (LOG)) <= vertexCount)
            LOG++;
        LOG++;
        ancestorAtDepth = new int[vertexCount][LOG];
        timeIn = new int[vertexCount];
        timeOut = new int[vertexCount];
        depth = new int[vertexCount];
        subtreeSize = new int[vertexCount];
        used = new boolean[vertexCount];
        dfs(0, 0, 0);
    }
    
    public LcaComputer(ArrayList<Integer>[] g) {
        this(g, 0);
    }

    private void dfs(int vertexId, int parent, int curHeight) {
        used[vertexId] = true;
        timeIn[vertexId] = timer++;
        depth[vertexId] = curHeight;
        subtreeSize[vertexId] = 1;
        ancestorAtDepth[vertexId][0] = parent;
        for (int i = 1; i < LOG; i++)
            ancestorAtDepth[vertexId][i] = ancestorAtDepth[ancestorAtDepth[vertexId][i - 1]][i - 1];
        for (int to : g[vertexId])
            if (!used[to]) {
                dfs(to, vertexId, curHeight + 1);
                subtreeSize[vertexId] += subtreeSize[to];
            }
        timeOut[vertexId] = timer++;
    }

    public boolean isAncestor(int a, int b) {
        return timeIn[a] <= timeIn[b] && timeIn[b] <= timeOut[a];
    }

    public int getLca(int a, int b) {
        if (isAncestor(a, b))
            return a;
        if (isAncestor(b, a))
            return b;
        for (int i = LOG - 1; i >= 0; i--)
            if (!isAncestor(ancestorAtDepth[a][i], b))
                a = ancestorAtDepth[a][i];
        return ancestorAtDepth[a][0];
    }

    public int getAncestorByDepth(int v, int deltaDepth) {
        for (int i = 0; i < LOG; i++)
            if ((deltaDepth & (1 << i)) != 0)
                v = ancestorAtDepth[v][i];
        return v;
    }
    
    public int[] getSubtreeSizes() {
        return subtreeSize;
    }
    
    public int[] getDepths() {
        return depth;
    }
    
    public int getVertexCount() {
        return vertexCount;
    }
}

class FastScanner {
    private StringTokenizer tokenizer;
    private BufferedReader reader;

    public FastScanner(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            String line = null;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                // ignore
            }
            if (line == null)
                return null;
            tokenizer = new StringTokenizer(line);
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

