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.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.ObjectInputStream.GetField;
import java.math.BigInteger;
import java.security.KeyStore.Entry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
    static FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out = new PrintWriter(System.out);
    static boolean file = false;
    static final int maxn = (int)1e5 + 11;
    static int inf = (int)1e9;
    static int n,m;
    static ArrayList<Integer> g[] = new ArrayList[maxn];
    static int P[][] = new int[20][maxn];
    static int level[] = new int[maxn];
    static int child[] = new int[maxn];
    
    private static void solve() throws Exception {
        for (int i=0; i<maxn; i++) {
            g[i] = new ArrayList<Integer>();
        }
        n = in.nextInt();
        for (int j=0; j<n-1; j++) {
            int t1 = in.nextInt();
            int t2 = in.nextInt();
            g[t1].add(t2);
            g[t2].add(t1);
        }
        dfs(1,0,1);
        
        preCalc();
        
        int q = in.nextInt();
        
        for (int j=1; j<=q; j++) {
            int x = in.nextInt();
            int y = in.nextInt();
            Pair p = getLCA(x,y);
            
            if (x==y) {
                out.println(n);
                continue;
            }
            if (p.y!=-1)
                if (level[P[0][p.x]] - level[x]== level[P[0][p.x]] - level[y]) {
                    out.println(n - child[p.x] - child[p.y]);
                    continue;
                }
            
            if ((level[x]-level[P[0][p.x]]+level[y]-level[P[0][p.x]])%2==1) {
                out.println(0);
            } else {
                int distx = level[x] - level[P[0][p.x]];
                int disty = level[y] - level[P[0][p.x]];
                int var = 0;
                if (p.y==-1) var = 1; 
                    
                if (level[y]>=level[x]) {
                    int v = findVertex((distx+disty-var)/2,y);
                    int t = findLCA2(v,y);
//                  out.println("v t " + v + " " + t);
                    out.println(child[v]-child[t]);
                } else {
                    int v = findVertex((distx+disty-var)/2,x);
                    int t = findLCA2(v,x);
//                  out.println("v t " + v + " " + t);
                    out.println(child[v]-child[t]);
                }
            }
            
        }
        
    }   

    private static int findLCA2(int x, int y) {
        for (int j=19; j>=0; j--) {
            if (level[P[j][y]] > level[x]) {
                y = P[j][y];
            }
            if (level[P[j][x]] > level[x]) {
                x = P[j][x];
            }
        }
        if (level[x]>level[y]) {
            return x;
        } else {
            return y;
        }
    }

    private static int findVertex(int dist, int y) {
        int sum = 0;
        for (int j=19; j>=0; j--) {
            if (sum+(1<<j)<=dist) {
                y = P[j][y];
                sum+=(1<<j);
            }
        }
        return y;
    }

    private static Pair getLCA(int x, int y) {
        for (int j=19; j>=0; j--) {
            if (level[P[j][y]] >= level[x]) y = P[j][y];
            if (level[P[j][x]] >= level[y]) x = P[j][x];
        }
        
        if (x==y) return new Pair(x,-1);
        
        for (int j=19; j>=0; j--) {
            if (P[j][x]!=P[j][y]) {
                x = P[j][x];
                y = P[j][y];
            }
        }
        
        return new Pair(x,y);
    }

    private static void preCalc() {
        for (int j=1; j<20; j++) {
            for (int i=1; i<=n; i++) {
                P[j][i] = P[j-1][P[j-1][i]];
            }
        }
    }

    private static int dfs(int v, int p, int degree) {
        level[v] = degree;
        P[0][v] = p;
        int count = 1;
        for (int i=0; i<g[v].size(); i++) {
            int to = g[v].get(i);
            if (to==p) continue;
            count += dfs(to,v,degree+1);
        }
        return child[v] = count;
    }

    public static void main (String [] args) throws Exception {
        
        if (file) {
            in = new FastReader(new BufferedReader(new FileReader("input.txt")));
            out = new PrintWriter ("output.txt");
        }
        
        solve();
        out.close();
    }

}

class Pair implements Comparable<Pair> {
    int x,y;
    
    public Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }
    @Override
    public boolean equals(Object obj) {
        Pair p = (Pair)obj;
        if (p.x == x && p.y==y) return true;
        return false;
    }
    @Override
    public int hashCode() {
        // TODO Auto-generated method stub
        return x;
    }
    @Override
    public int compareTo(Pair p) {
        if (x<p.x)return 1;
        else if (x==p.x) return 0;
        else return -1;
    }
    
    
    
    
    
}

class FastReader {
    BufferedReader bf;
    StringTokenizer tk = null;

    public FastReader(BufferedReader bf) {
        this.bf = bf;
    }
    
    public String nextToken () throws Exception {
        if (tk==null || !tk.hasMoreTokens()) {
            tk = new StringTokenizer(bf.readLine());
        }
        return tk.nextToken();
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}