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.text.*;
import java.lang.*;
import java.math.*;
 
public class Main{
	
	static ArrayList a[]=new ArrayList[200001];
	static boolean visited[]=new boolean [200001];
	static int level[]=new int [200001];
	static int dp[]=new int [200001];
	static int parent[][]=new int[200001][20];
	static void dfs(int n) {
		visited[n]=true;
		dp[n]++;
		for(int i=0;i<a[n].size();i++) {
			int id=(int) a[n].get(i);
			if(!visited[id]) {
				level[id]=level[n]+1;
				parent[id][0]=n;
				dfs(id);
				dp[n]+=dp[id];
			}
		}
	}
	static void cal(int n) {
		for(int i=1;i<20;i++) {
			for(int j=1;j<=n;j++) {
				if(parent[j][i-1]!=-1) {
					parent[j][i]=parent[parent[j][i-1]][i-1];
				}
			}
		}
	}
	static void pre() {
		for(int i=0;i<200001;i++) {
			for(int j=0;j<20;j++) {
				parent[i][j]=-1;
			}
		}
	}
	static int dis(int n,int d) {
	    for(int i=0;i<20;i++) {
	    	if(((d>>i)&1)==1) {
	    		n=parent[n][i];
	    	}
	    }
	    return n;
	}
	static int lca(int a,int b) {
		if(level[a]>level[b]) {
			int temp=a;
			a=b;
			b=temp;
		}
		int diff=level[b]-level[a];
		for(int i=0;i<20;i++) {
			if(((diff>>i)&1)==1) {
				b=parent[b][i];
			}
		}
		if(a==b) return a;
		for(int i=19;i>=0;i--) {
			if(parent[a][i]!=parent[b][i]) {
				a=parent[a][i];
				b=parent[b][i];
			}
		}
		return parent[a][0];
	}
	public void solve () {
		InputReader in = new InputReader(System.in);
	    PrintWriter pw = new PrintWriter(System.out); 
	    int n=in.nextInt();
	    for(int i=0;i<=n;i++)
	    	a[i]=new ArrayList<Integer>();
	    for(int i=0;i<n-1;i++) {
	    	int x=in.nextInt();
	    	int y=in.nextInt();
	    	a[x].add(y);
	    	a[y].add(x);
	    }
	    pre();
	    dfs(1);
	    cal(n);
	    int q=in.nextInt();
	    while(q-->0) {
	    	int x=in.nextInt();
	    	int y=in.nextInt();
	    	int z=lca(x,y);
	    	int dis=level[x]+level[y]-2*level[z];
	    	int ans=0;
	    	if(dis%2==0) {
	    	    dis=dis/2;
	    	    if(dis==0) {
	    	    	ans=n;
	    	    }
	    	    else if(level[x]==level[y]) {
	    			int a=dis(x,dis-1);
	    			int b=dis(y,dis-1);
	    			ans=n-dp[a]-dp[b];
	    		}
	    		else if(level[x]>level[y]) {
	    			int a=dis(x,dis-1);
	    			ans=dp[parent[a][0]]-dp[a];
	    		}
	    		else {
	    			int a=dis(y,dis-1);
	    			ans=dp[parent[a][0]]-dp[a];
	    		}
	    	}
	    	pw.println(ans);
	    }
		pw.flush();
		pw.close();
	}
	public static void main(String[] args) throws Exception {
        
        
        new Thread(null,new Runnable() {
        	public void run() {
        		new Main().solve();
        	}
        },"1",1<<26).start();
        
        
    }
    static void debug(Object... o) {
    	System.out.println(Arrays.deepToString(o));
        }
        
        static class InputReader 
        {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;
 
        public InputReader(InputStream stream) 
        {
            this.stream = stream;
        }
        public int snext() 
        {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) 
            {
                curChar = 0;
                try 
                {
                    snumChars = stream.read(buf);
                } 
                catch (IOException e) 
                {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int nextInt() 
        {
            int c = snext();
            while (isSpaceChar(c)) 
            {
                c = snext();
            }
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do 
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public long nextLong()
        {
            int c = snext();
            while (isSpaceChar(c)) 
            {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') 
            {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do 
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public int[] nextIntArray(int n) 
        {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) 
            {
                a[i] = nextInt();
            }
            return a;
        }
 
        public String readString()
        {
            int c = snext();
            while (isSpaceChar(c)) 
            {
                c = snext();
            }
            StringBuilder res = new StringBuilder();
            do 
            {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }
 
        public String nextLine() 
        {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do 
            {
                res.appendCodePoint(c);
                c = snext();
            } while (!isEndOfLine(c));
            return res.toString();
        }
 
        public boolean isSpaceChar(int c) 
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        private boolean isEndOfLine(int c) 
        {
            return c == '\n' || c == '\r' || c == -1;
        }
 
        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }
        public static long mod = 1000000007;
        public static int d;
        public static int p;
        public static int q;
        public void extended(int a,int b) {
        	if(b==0) {
        		d=a;
        		p=1;
        		q=0;
        	}
        	else
        	{
        		extended(b,a%b);
        		int temp=p;
        		p=q;
        		q=temp-(a/b)*q;
        	}
        }
        public static long[] shuffle(long[] a,Random gen)
        {
            int n = a.length;
            for(int i=0;i<n;i++)
            {
                int ind = gen.nextInt(n-i)+i;
                long temp = a[ind];
                a[ind] = a[i];
                a[i] = temp;
            }
            return a;
        }
        
        public static void swap(int a, int b){
            int temp = a;
            a = b;
            b = temp;
        }
        
        public static HashSet<Integer> primeFactorization(int n)
        {
            HashSet<Integer> a =new HashSet<Integer>();
            for(int i=2;i*i<=n;i++)
            {
                while(n%i==0)
                {
                    a.add(i);
                    n/=i;
                }
            }
            if(n!=1)
                a.add(n);
            return a;
        }
        
        public static void sieve(boolean[] isPrime,int n)
        {
            for(int i=1;i<n;i++)
                isPrime[i] = true;
            
            isPrime[0] = false;
            isPrime[1] = false;
            
            for(int i=2;i*i<n;i++)
            {
                if(isPrime[i] == true)
                {
                    for(int j=(2*i);j<n;j+=i)
                        isPrime[j] = false;
                }
            }
        }
        
        public static int GCD(int a,int b)
        {
            if(b==0)
                return a;
            else
                return GCD(b,a%b);
        }
        
        static class pair implements Comparable<pair>
        {
            Integer x;
            Long y;
            pair(int x,long y)
            {
                this.x=x;
                this.y=y;
                
            }
            
           
            public int compareTo(pair o) {
                int result = x.compareTo(o.x);
                if(result==0)
                    result = y.compareTo(o.y);
                
                return result;
            }  
            
            public String toString()
            {
                return x+" "+y;
            }
            
            public boolean equals(Object o)
            {
                if (o instanceof pair)
                {
                    pair p = (pair)o;
                    return p.x == x && p.y == y ;
                }
                return false;
            }
            
            public int hashCode()
            {
                return new Long(x).hashCode()*31 + new Long(y).hashCode();
            }
        }
        
    
}
class pair implements Comparable<pair>
{
    Integer x;
    Long y;
    pair(int x,long y)
    {
        this.x=x;
        this.y=y;
        
    }
    
   
    public int compareTo(pair o) {
        int result = x.compareTo(o.x);
        if(result==0)
            result = y.compareTo(o.y);
        
        return result;
    }  
    
    public String toString()
    {
        return x+" "+y;
    }
    
    public boolean equals(Object o)
    {
        if (o instanceof pair)
        {
            pair p = (pair)o;
            return p.x == x && p.y == y ;
        }
        return false;
    }
    
    public int hashCode()
    {
        return new Long(x).hashCode()*31 + new Long(y).hashCode();
    }
}
