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.text.DecimalFormat;
import java.text.NumberFormat;
 

@SuppressWarnings("unchecked")
public class Main {
      
    int mod = 1000000007;

    public class SegmentTree{

       int n;
       int[] tree;

       SegmentTree(int[] arr){

          this.n = arr.length; 
          this.tree = new int[2 * n];

          for(int i = n; i < 2 * n; i++){
              this.tree[i] = arr[i - n];
          }

          for(int i = n - 1; i >= 1; i--){
              this.tree[i] = Math.min(this.tree[2 * i], this.tree[2 * i + 1]);
          }

       }

       public boolean isIn(int a){

          a += n;
          return tree[a] >= 1000000;

       }

       public int query(int l, int r){

          int res = Integer.MAX_VALUE;
          l = l + n;
          r = r + n;

          while(l < r){

              if(l % 2 == 1){
                  res = Math.min(res, tree[l]); 
                  l++;
              }

              if(r % 2 == 1){
                  r--;
                  res = Math.min(res, tree[r]);
              }

              l /= 2;
              r /= 2;
          }

          return res;
       }

       public void update(int idx, int v){
          
          idx += n; this.tree[idx] += v;
          while(idx > 1){
             idx /= 2;
             this.tree[idx] = Math.min(this.tree[2 * idx], this.tree[2 * idx + 1]);
          }
       }


    }

    int n, time;
    List<Integer>[] graph;
    int[][] memo;
    int[] tin, tout, depth, size;

    public void solve() throws IOException{
    
         n = in.nextInt();
         graph = new List[n + 1];
         memo = new int[n + 1][31];
         tin = new int[n + 1];
         tout = new int[n + 1];
         depth = new int[n + 1];
         size = new int[n + 1];
         time = 0;
         for(int i = 0; i <= n; i++) graph[i] = new ArrayList<>();
         for(int i = 1; i < n; i++){
            int u = in.nextInt();
            int v = in.nextInt();
            graph[u].add(v);
            graph[v].add(u);
         }
         
         dfs(1, 0, 0);

         int m = in.nextInt();

         for(int i = 0; i < m; i++){
            
            int u = in.nextInt();
            int v = in.nextInt();
            int l = lca(u, v);
            

            if(u == v){
               out.println(n);
            }else if(depth[u] - depth[l] == depth[v] - depth[l]){
               u = lift(u, l);
               v = lift(v, l);
               out.println(n - size[u] - size[v]); 
            }else{
               if(depth[u] < depth[v]){
                  int tmp = u;
                  u = v;
                  v = tmp;
               }

               int dist = depth[u] + depth[v] - 2 * depth[l];
               if(dist % 2 == 1){
                  out.println(0);
               }else{

                  dist /= 2;
                  int start = u;

                  for(int t = 30; t >= 0; t--){
                     if(memo[start][t] != 0 && depth[u] - depth[memo[start][t]] < dist){
                        start = memo[start][t];
                     }
                  }

                  int mid = memo[start][0];
                  out.println(size[mid] - size[start]);
               }
            }
         }

    }

    public int lift(int u, int v){

         for(int i = 30; i >= 0; i--){
            if(memo[u][i] != 0 && !isAncestor(memo[u][i], v))
               u = memo[u][i];
         }

         return u;
    }

    public int dfs(int root, int parent, int d){

       depth[root] = d;
       tin[root] = time;
       time++;
       memo[root][0] = parent;
       size[root] = 1;

       for(int i = 1; i <= 30; i++){
          memo[root][i] = memo[memo[root][i -1]][i - 1]; // important construction step 2^i + 2^i = 2 ^ (i + 1)
       }

       for(int child: graph[root]){
          if(child == parent) continue;
          size[root] += dfs(child, root, d + 1);
       }
         
       tout[root] = time;
       time++;

       return size[root];

    }

    public boolean isAncestor(int v1, int v2){
         return tin[v1] <= tin[v2] && tout[v1] >= tout[v2];
    }

    public int lca(int v1, int v2){

       if(isAncestor(v1, v2)) return v1;
       if(isAncestor(v2, v1)) return v2;

       for(int i = 30; i >= 0; i--){
          if(memo[v1][i] != 0 && !isAncestor(memo[v1][i], v2)){
             v1 = memo[v1][i];     
          }
       }

       return memo[v1][0];
    }


    FastScanner in;
    PrintWriter out;
    
    static class FastScanner {
 
        BufferedReader br;
        StringTokenizer st;
 
        FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
            st = null;
        }
 
        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
 
        String nextLine() throws IOException {
            if (st == null || !st.hasMoreTokens())
                return br.readLine();
            StringBuilder result = new StringBuilder(st.nextToken());
            while (st.hasMoreTokens()) {
                result.append(" ");
                result.append(st.nextToken());
            }
            return result.toString();
        }
 
        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
 
        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
 
        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
 
    }
 
    void run() throws IOException {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out, false);
        solve();
        out.close();
    }
 
    public static void main(String[] args) throws IOException{
        new Main().run();
    }
 
    public void printArr(int[] arr){
        for(int i = 0; i < arr.length; i++){
            out.print(arr[i] + " ");
        }
        out.println();
    }
 
    public long gcd(long a, long b){
        if(a == 0) return b;
        return gcd(b % a, a);
    }

    public boolean isPrime(long num){

        if(num == 0 || num == 1){
            return false;
        }

        for(int i = 2; i * i <= num; i++){
            if(num % i == 0){
                return false;
            }
        }

        return true;
    }

    public class Pair<A, B>{
        public A x; 
        public B y;

        Pair(A x, B y){
            this.x = x;
            this.y = y;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Pair<?, ?> pair = (Pair<?, ?>) o;
            if (!x.equals(pair.x)) return false;
            return y.equals(pair.y);
        }

        @Override
        public int hashCode() {
            int result = x.hashCode();
            result = 31 * result + y.hashCode();
            return result;
        }

    }

    class Tuple{
        int x; int y; int z;
        Tuple(int ix, int iy, int iz){
            x = ix;
            y = iy;
            z = iz;
        }
    }
}
