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.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Main {

	public static void main(String[] args) throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		int n=nextInt();
		int [] tree=new int[n+1]; //se ubican los padres de cada nodo
		int [] depth=new int[n+1]; //profundidad de cada nodo (de la raiz al nodo)
		int [] childs=new int[n+1];
		ArrayList<Integer> [] grafo=new ArrayList[n+1];
		for (int i = 1; i <=n; i++) {
			grafo[i]=new ArrayList<>();
			depth[i]=-1;
		}
		tree[1]=-1;
		for (int i = 0; i <n-1; i++) {
			int a=nextInt();
			int b=nextInt();
			grafo[a].add(b);
			grafo[b].add(a);
		}
		dfs(1, grafo, depth, 0, childs,tree);
		int logaritmo=Log2(n);
		int [][] m=new int [n+1][logaritmo+1];
		lca_preprocess(m,n,logaritmo,tree);
		int queries=nextInt();
		for(int i=0;i<queries;i++){
			int a=nextInt();
			int b=nextInt();
			if(a==b){
				System.out.println(n);
			}
			else{
				if((depth[a]-depth[b])%2!=0){
					System.out.println("0");
				}
				else{
					int []answer=lca(a,b,depth,m,logaritmo);
					if(answer[0]==1){ //the lca is the node in the middle
						int p=(n-childs[answer[1]]-childs[answer[2]]-2);
						System.out.println(p);
					}
					else{
						if(depth[a] < depth[b]){
					        int temp=a;
					        a=b;
					        b=temp;
					    } 
					    int distance =answer[2]/2-1;
					    int node=a;
					    while(distance > 0){
					        int raise_by = Log2(distance); //logaritmo base 2 de distance
					        node = m[node][raise_by];
					        int temp=1 << raise_by;
					        distance -= temp;
					    }
					    int node2=m[node][0];
					    int p=(childs[node2]-childs[node]);
					    System.out.println(p);
					}
				}
			}
		}
	}
	
	public static void dfs(int v,ArrayList<Integer> []g,int []d,int depth,int []childs,int []tree){
		if(d[v]==-1){ //no esta visitado
			d[v]=depth;
			for (int i = 0; i < g[v].size(); i++) {
				int vecino=g[v].get(i);
				if(d[vecino]==-1){ //no esta visitado
					dfs(vecino,g,d,depth+1,childs,tree);
					childs[v]+=childs[vecino]+1;
					tree[vecino]=v;
				}
			}
		}
	}
		
	public static int Log2(int x){
		int y=x;
		int ans = 0;
		while (y != 1){
		    ans++;
		    y>>=1;
		}
		return ans;
	}
		
	public static void lca_preprocess(int [][] t,int n,int log,int[] tree){
		for (int i = 1; i <=n; i++) {
			t[i][0]=tree[i]; //la primera columna es los padres de cada nodo
			for (int j = 1; j <=log; j++) {
				t[i][j]=-1;
			}
		}
		for(int j = 1; j <=log; ++j){
	        for(int i = 1 ; i <=n ; ++i){
	            if(t[i][j-1] != -1){
	            	t[i][j] =t[t[i][j-1]][j-1] ; 
	            }
	        }
	    }
	} 
	
	public static int[] lca(int u ,int v,int[] level,int [][] t,int logN){
		if(level[u] < level[v]){
	        int temp=u;
	        u=v;
	        v=temp;
	    }
	   	int answer=0; 
	    int distance = level[u] - level[v] ; 
	    int flag=0;
	    if(distance==0){
	    	flag=1;
	    }
	    while(distance > 0){
	        int raise_by = Log2(distance); //logaritmo base 2 de distance
	        u = t[u][raise_by];
	        int temp=1 << raise_by;
	        distance -= temp; 
	        answer+=temp;
	    }
	    if(u == v){
	        return new int[]{0,u,answer}; 
	    }
	    //System.out.println("prueba "+u+" "+v+" answer so far "+answer);
	    for(int j = logN; j >= 0 ; --j){
	        if((t[u][j] != -1) && (t[u][j] != t[v][j])){
	        	u = t[u][j] ; 
	            v = t[v][j] ;  
	            //System.out.println("answer "+answer+" se le sumo "+tDist[u][j]+" "+tDist[v][j]);
	            int temp=1 << j;
		        answer+=2*temp;
	        }
	    }
	    if(flag==1){
	    	return new int[]{1,u,v};
	    }
	    else{
	    	return new int[]{0,t[u][0],answer+2};
	    }
	    //System.out.println("nodos "+u+" "+v);
	    //return new int[]{flag+1,t[u][0],answer+2,u,v};
	}
		
	static BufferedReader in;
	static StringTokenizer str;
	static String SK;
	
	public static String next() throws IOException {
		while ((str == null) || (!str.hasMoreTokens())) {
			SK = in.readLine();
			if (SK == null)
				return null;
			str = new StringTokenizer(SK);
		}
		return str.nextToken();
	}
		
	public static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}
		
	public static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}
		
	public static long nextLong() throws IOException {
		return Long.parseLong(next());
	}
		
	public static char[] charArray() throws IOException{
		return next().toCharArray();
	}
}