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.
/*
 *   
 * CREATED BY : NAITIK V
 * 
 * 
 */

import java.util.*;
import java.io.*;
import java.math.*;

public class Main

{ 
	 static FastReader sc=new FastReader(); 
	 static long dp[][][];
	 static int mod=1000000007;
	 static int max;
	  public static void main(String[] args)
{
		   PrintWriter out=new PrintWriter(System.out);
		   StringBuffer sb=new StringBuffer("");
		  int ttt=1;
		  // ttt =i();
		 
	        outer :while (ttt-- > 0) 
			{
	        	int n=i()+1;
	        	int m=n-2;
	        	ArrayList<Integer> A[]=new ArrayList[n];
	        	for(int i=0;i<A.length;i++) {
	        		A[i]=new ArrayList<Integer>();
	        	}
	        	Pair P[]=new Pair[m];
	        	TreeMap<Pair,Integer> map=new TreeMap<Main.Pair, Integer>();
	        	for(int i=0;i<m;i++) {
	        		int a=i();
	        		int b=i();
	        		P[i]=new Pair(Math.min(a, b), Math.max(a, b));
	        		Pair p=new Pair(Math.min(a, b), Math.max(a, b));
	        		A[a].add(b);
	        		A[b].add(a);
	        	}
	        	
	        	int level[]=new int[n];
	        	int maxn=(int)(Math.log10(n-1)/(Math.log10(2)));
	        	int lca[][]=new int[n][maxn+1];
	        	for(int i=0;i<n;i++) {
	        		for(int j=0;j<=maxn;j++) {
	        			lca[i][j]=-1;
	        		}
	        	}
	        	boolean v[]=new boolean[n];
	        	dfs(A, 1, 0, level, lca, -1);
	        	for(int i=1;i<=maxn;i++) {
	        		for(int j=1;j<n;j++) {
	        			if(lca[j][i-1]!=-1) {
	        				int par=lca[j][i-1];
	        				lca[j][i]=lca[par][i-1];
	        			}
	        		}
	        	}
	        	int size[]=new int[n];
	        	subtreesize(A, 1, v, size);
	        	
	        	
	        	
	        	int q=i();
	        	for(int i=0;i<q;i++) {
	        		int a=i();
	        		int b=i();
	        		if(a==b) {
	        			out.println((n-1)+" ");
	        			continue;
	        		}
	        		if(level[a]==level[b]) {
	        			
	        		int LCA=getlca(level, lca, a, b, maxn);
	        		int lev=level[LCA];
	        		int d=level[b]-lev-1;
	        		 while(d>0) {
    					 int j=(int)(Math.log10(d)/Math.log10(2));
    					 b=lca[b][j];
    					 d-=1<<j;
    				 }
	        		 d=level[a]-lev-1;
	        		 while(d>0) {
    					 int j=(int)(Math.log10(d)/Math.log10(2));
    					 a=lca[a][j];
    					 d-=1<<j;
    				 }
	        		 
	        		
	        		
	        		int res=n-1-size[a]-size[b];
	        		out.println(res);
	        		}
	        		else {
	        			if(level[a]>level[b]) {
	        				int y=a;
	        				a=b;
	        				b=y;
	        			}
	        			int LCA=getlca(level, lca, a, b, maxn);
	        			int diff=level[a]+level[b]-2*level[LCA];
	        			if(diff%2!=0) {
	        				out.println("0");
	        			}
	        			else {
	        				int d=diff/2;
	        				
	        				 int t=b;;
	        				 while(d>0) {
	        					 int j=(int)(Math.log10(d)/Math.log10(2));
	        					 b=lca[b][j];
	        					 d-=1<<j;
	        				 }
	        				 d=diff/2-1;
	        				 int lowernode=b;
	        				 b=t;
	        				 while(d>0) {
	        					 int j=(int)(Math.log10(d)/Math.log10(2));
	        					 b=lca[b][j];
	        					 d-=1<<j;
	        				 }
	        				 int uppernode=b;
	        				 int res=size[lowernode]-size[uppernode];
	        				 out.println(res);
	        				 
	        			}
	        		}
	        		
	        		
	        	}
			
	        	
	        	
	        	
	        	
	        }
	        	
		
		  
		  

	     //System.out.println(sb.toString());
		     out.close();
	     
	     
	    //CHECK FOR N=1                    //CHECK FOR M=0
        //CHECK FOR N=1                    //CHECK FOR M=0
       	//CHECK FOR N=1
       	//CHECK FOR N=1
       	//CHECK FOR N=1
		        
		     
    }
	  private static int subtreesize(ArrayList<Integer> [] A, int s, boolean[] v,int size[]) {
			v[s]=true;
			int c=1;
			for(int i=0;i<A[s].size();i++) {
				int child=A[s].get(i);
				if(!v[child]) {
					c+=subtreesize(A, child, v, size);
				}
			}
			size[s]=c;
			return c;
			
		}
	 
static void dfs(ArrayList<Integer> A[],int i,int dis,int d[],int lca[][],int par) {
	d[i]=dis;
	lca[i][0]=par;
	for(int child : A[i]) {
		if(child!=par) {
			dfs(A, child, dis+1, d, lca, i);
		}
	}
 }
 static int getlca(int level[],int lca[][],int a,int b,int maxn) {
	 if(level[b]<level[a]) {
		 int t=a;
		 a=b;
		 b=t;
	 }
	 int d=level[b]-level[a];
	 while(d>0) {
		 int i=(int)(Math.log10(d)/Math.log10(2));
		 b=lca[b][i];
		 d-=1<<i;
	 }
	 if(a==b)
		 return a;
	 for(int i=maxn;i>=0;i--) {
		 if(lca[a][i]!=-1 && lca[a][i]!=lca[b][i]) {
			 a=lca[a][i];
			 b=lca[b][i];
		 }
	 }
	 return lca[a][0];
 }

 







static class Pair implements Comparable<Pair>
     {
    	 int x;
    	 int y;
    	 Pair(int x,int y){
    		 this.x=x;
    		 this.y=y;
    		 
    	 }
		@Override
		public int compareTo(Pair o) {
			if(this.x>o.x)
				return 1;
			else if(this.x<o.x)
				return -1;
			else {
				if(this.y>o.y)
					return 1;
				else if(this.y<o.y)
					return -1;
				else
					return 0;
			}
		}
		
		/* FOR TREE MAP PAIR USE */
		
//		public int compareTo(Pair o) {
// 			if (x > o.x) {
// 				return 1;
// 			}
// 			if (x < o.x) {
// 				return -1;
// 			}
// 			if (y > o.y) {
// 				return 1;
// 			}
// 			if (y < o.y) {
// 				return -1;
// 			}
// 			return 0;
// 		}
	
		
     }

static int[] input(int n) {
	int A[]=new int[n];
	   for(int i=0;i<n;i++) {
		   A[i]=sc.nextInt();
	   }
	   return A;
   }
static long[] inputL(int n) {
	long A[]=new long[n];
	   for(int i=0;i<n;i++) {
		   A[i]=sc.nextLong();
	   }
	   return A;
   }
static String[] inputS(int n) {
	String A[]=new String[n];
	   for(int i=0;i<n;i++) {
		   A[i]=sc.next();
	   }
	   return A;
   }
static long sum(int A[]) {
	long sum=0;
	for(int i : A) {
		sum+=i;
	}
	return sum;
}
static long sum(long A[]) {
	long sum=0;
	for(long i : A) {
		sum+=i;
	}
	return sum;
}
static void reverse(long A[]) {
	int n=A.length;
	long B[]=new long[n];
	for(int i=0;i<n;i++) {
		B[i]=A[n-i-1];
	}
	for(int i=0;i<n;i++)
		A[i]=B[i];
	
}
static void reverse(int A[]) {
	int n=A.length;
	int B[]=new int[n];
	for(int i=0;i<n;i++) {
		B[i]=A[n-i-1];
	}
	for(int i=0;i<n;i++)
		A[i]=B[i];
	
}
static void input(int A[],int B[]) {
	   for(int i=0;i<A.length;i++) {
		   A[i]=sc.nextInt();
		   B[i]=sc.nextInt();
	   }
}
static int[][] input(int n,int m){
	int A[][]=new int[n][m];
	for(int i=0;i<n;i++) {
		for(int j=0;j<m;j++) {
			A[i][j]=i();
		}
	}
	return A;
}
static char[][] charinput(int n,int m){
	char A[][]=new char[n][m];
	for(int i=0;i<n;i++) {
		String s=s();
		for(int j=0;j<m;j++) {
			A[i][j]=s.charAt(j);
		}
	}
	return A;
}
static int find(int A[],int a) {
	  if(A[a]==a)
		  return a;
	  return A[a]=find(A, A[a]);
}
static int max(int A[]) {
	int max=Integer.MIN_VALUE;
	for(int i=0;i<A.length;i++) {
		max=Math.max(max, A[i]);
	}
	return max;
}
static int min(int A[]) {
	int min=Integer.MAX_VALUE;
	for(int i=0;i<A.length;i++) {
		min=Math.min(min, A[i]);
	}
	return min;
}
static long max(long A[]) {
	long max=Long.MIN_VALUE;
	for(int i=0;i<A.length;i++) {
		max=Math.max(max, A[i]);
	}
	return max;
}
static long min(long A[]) {
	long min=Long.MAX_VALUE;
	for(int i=0;i<A.length;i++) {
		min=Math.min(min, A[i]);
	}
	return min;
}
static long [] prefix(long A[]) {
	long p[]=new long[A.length];
	p[0]=A[0];
	for(int i=1;i<A.length;i++)
		p[i]=p[i-1]+A[i];
	return p;
}
static long [] prefix(int A[]) {
	long p[]=new long[A.length];
	p[0]=A[0];
	for(int i=1;i<A.length;i++)
		p[i]=p[i-1]+A[i];
	return p;
}
static long [] suffix(long A[]) {
	long p[]=new long[A.length];
	p[A.length-1]=A[A.length-1];
	for(int i=A.length-2;i>=0;i--)
		p[i]=p[i+1]+A[i];
	return p;
}
static long [] suffix(int A[]) {
	long p[]=new long[A.length];
	p[A.length-1]=A[A.length-1];
	for(int i=A.length-2;i>=0;i--)
		p[i]=p[i+1]+A[i];
	return p;
}
static long power(long x, long y, long p)
{

	if(y==0)
		return 1;
	if(x==0)
		return 0;
    long res = 1;
    x = x % p;

    while (y > 0) {

        if (y % 2 == 1)
            res = (res * x) % p;

        y = y >> 1; 
        x = (x * x) % p;
    }

    return res;
}
static void print(int A[]) {
	for(int i : A) {
		System.out.print(i+" ");
	}
	System.out.println();
}
static void print(long A[]) {
	for(long i : A) {
		System.out.print(i+" ");
	}
	System.out.println();
}
static long mod(long x) {
	  return ((x%mod + mod)%mod);
}
static String reverse(String s) {
	StringBuffer p=new StringBuffer(s);
	p.reverse();
	return p.toString();
}

     static int i() {
    	 return sc.nextInt();
     }
     static String s() {
    	 return sc.next();
     }
     static long l() {
    	 return sc.nextLong();
     }  
     static void sort(int[] A){
        int n = A.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            int tmp = A[i];
            int randomPos = i + rnd.nextInt(n-i);
            A[i] = A[randomPos];
            A[randomPos] = tmp;
        }
        Arrays.sort(A);
     }
     static void sort(long[] A){
	        int n = A.length;
	        Random rnd = new Random();
	        for(int i=0; i<n; ++i){
	            long tmp = A[i];
	            int randomPos = i + rnd.nextInt(n-i);
	            A[i] = A[randomPos];
	            A[randomPos] = tmp;
	        }
	        Arrays.sort(A);
	     }
  static String sort(String s) {
 	 Character ch[]=new Character[s.length()];
 	 for(int i=0;i<s.length();i++) {
 		 ch[i]=s.charAt(i);
 	 }
 	 Arrays.sort(ch);
 	 StringBuffer st=new StringBuffer("");
 	 for(int i=0;i<s.length();i++) {
 		 st.append(ch[i]);
 	 }
 	 return st.toString();
  }
  static HashMap<Integer,Integer> hash(int A[]){
	  HashMap<Integer,Integer> map=new HashMap<Integer, Integer>();
	  for(int i : A) {
		  if(map.containsKey(i)) {
			  map.put(i, map.get(i)+1);
		  }
		  else {
			  map.put(i, 1);
		  }
	  }
	  return map;
  }
  static TreeMap<Integer,Integer> tree(int A[]){
	  TreeMap<Integer,Integer> map=new TreeMap<Integer, Integer>();
	  for(int i : A) {
		  if(map.containsKey(i)) {
			  map.put(i, map.get(i)+1);
		  }
		  else {
			  map.put(i, 1);
		  }
	  }
	  return map;
  }
     static boolean prime(int n) 
	    { 
	        if (n <= 1) 
	            return false; 
	        if (n <= 3) 
	            return true; 
	        if (n % 2 == 0 || n % 3 == 0) 
	            return false; 
	        double sq=Math.sqrt(n);
	  
	        for (int i = 5; i <= sq; i = i + 6) 
	            if (n % i == 0 || n % (i + 2) == 0) 
	                return false; 
	        return true; 
	    } 
     static boolean prime(long n) 
	    { 
	        if (n <= 1) 
	            return false; 
	        if (n <= 3) 
	            return true; 
	        if (n % 2 == 0 || n % 3 == 0) 
	            return false; 
	        double sq=Math.sqrt(n);
	  
	        for (int i = 5; i <= sq; i = i + 6) 
	            if (n % i == 0 || n % (i + 2) == 0) 
	                return false; 
	        return true; 
	    } 
     static int gcd(int a, int b) 
     { 
         if (a == 0) 
             return b; 
         return gcd(b % a, a); 
     } 
     static long gcd(long a, long b) 
     { 
         if (a == 0) 
             return b; 
         return gcd(b % a, a); 
     } 
     
        
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
} 



