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.*;
import java.awt.image.AreaAveragingScaleFilter;
import static java.lang.Math.*;
import java.lang.*;



public class Main {
    static FastScanner in;
    static PrintWriter out;
    public static void main(String[] args) throws FileNotFoundException {
        runIO(0);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    public static void runIO(int R) throws FileNotFoundException{
        if (R==1){
            in = new FastScanner(new File("input.txt"));
            out = new PrintWriter(new File("output.txt"));
        } else
        {
            in = new FastScanner(System.in);
            out = new PrintWriter(System.out);
        }
    }
}


class Task {
    final int N = 100010;
    int n;
    Graph g;
    int a, b;

    int go_up(int a, int b) {
        for (int i = g.L; i >= 0; i--) {
            if (!g.Upper(g.up[a][i], b)) {
                a = g.up[a][i];
            }
        }

        return a;
    }

    public int query(int a, int b) {
        int l = g.LCA(a, b);
        int result = -1;

        if (a == b) {
            result = n;
        } else if (g.GetDist(a, l)==g.GetDist(b, l)) {
            a = go_up(a, l);
            b = go_up(b, l);

            result = n - g.size[a] - g.size[b];
        } else {

            if (g.level[a] < g.level[b]) {
                int temp = b;
                b = a;
                a = temp;
            }

            int to = a;
            int dist = g.GetDist(a, b);

            if (dist % 2 == 1) result = 0; else 
            {
                dist /= 2;

                for (int i = g.L; i >= 0; i--) {
                    if (g.level[a] - g.level[g.up[to][i]] < dist) {
                        to = g.up[to][i];
                    }
                }

                int mid = g.up[to][0];
                result = g.size[mid] - g.size[to];
            }
        }

        return result;
    }


    public void solve(int testNumber, FastScanner in, PrintWriter out) {
      n = in.nextInt();
      g = new Graph(n);
      for (int i=0; i<n-1; i++){
          a = in.nextInt();
          b = in.nextInt();
          g.AddUnorientalEdge(a, b);
      }
      int q = in.nextInt();
      g.Preprocessing();
      for (int i=0; i<q; i++){
          a = in.nextInt();
          b = in.nextInt();
          out.println(query(a, b));
      }

    }
}

class Graph{
    final int N = 100010;
    List<Integer>[] g = new ArrayList[N];
    int tin[] = new int[N];
    int tout[] = new int[N];
    int size[] = new int[N];
    int up[][] = new int[N][20];
    int partial_sum[] = new int[N];
    int level[] = new int[N];
    int timer, L;

    public Graph(int CountOfVertexes){
        timer=0;
        L=1;
        while ((1 << L)<=CountOfVertexes) L++;

        for (int i=1; i<=CountOfVertexes; i++) g[i] = new ArrayList<Integer>();
    }

    public void AddOrientalEdge(int a, int b){
        g[a].add(b);
    }

    public void AddUnorientalEdge(int a, int b){
        g[a].add(b);
        g[b].add(a);
    }

    public void Dfs(int v, int p, int down){
        tin[v] = ++timer;
        up[v][0]=p;
        for (int i=1; i<=L; i++) up[v][i] = up[up[v][i-1]][i-1];

        size[v]=1;
        level[v]=down;
        for (int i=0; i<g[v].size(); i++)
        {
            int to = g[v].get(i);
            if (to==p) continue;
            Dfs(to, v, down+1);
            size[v]+=size[to];
        }
        tout[v]=++timer;
    }

    public boolean Upper(int a, int b){
        return (tin[a]<=tin[b] && tout[a]>=tout[b]);
    }

    public int LCA(int a, int b){
        if (Upper(a, b)) return a;
        if (Upper(b, a)) return b;
        for (int i=L; i>=0; i--)
            if (!Upper(up[a][i], b)) a = up[a][i];
        return up[a][0];
    }

    public int GetDist(int a, int b){
        if (level[a]>level[b]){
            int temp = b;
            b = a;
            a = temp;
        }
        int lca = LCA(a, b);
        if (lca==a) return level[b]-level[a]; else
            return level[b]+level[a] - 2*level[lca];
    }

    public void Preprocessing(){
        Dfs(1, 1, 1);
    }

}

class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner(File f) {
        try {
            br = new BufferedReader(new FileReader(f));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public FastScanner(InputStream f) {
        br = new BufferedReader(new InputStreamReader(f));
    }

    String next() {
        while (st == null || !st.hasMoreTokens()) {
            String s = null;
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (s == null)
                return null;
            st = new StringTokenizer(s);
        }
        return st.nextToken();
    }

    boolean hasMoreTokens() {
        while (st == null || !st.hasMoreTokens()) {
            String s = null;
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (s == null)
                return false;
            st = new StringTokenizer(s);
        }
        return true;
    }

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

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }
}