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.*;

/**
 *
 * @author Saju
 *
 */

public class Main {

//	static int[] dx = { 0, 1, 0, -1 };
//	static int[] dy = { -1, 0, 1, 0 };
//
//	static int[] ddx = { 0, 1, 0, -1, -1, 1, 1, -1 };
//	static int[] ddy = { -1, 0, 1, 0, -1, -1, 1, 1 };
//
//	static int[] kx = { 2, 1, -1, -2, -2, -1, 1, 2 };
//	static int[] ky = { 1, 2, 2, 1, -1, -2, -2, -1 };
//
//	static long MOD = Long.MAX_VALUE;
//
//	static final int MAX = 1000007;
//	static long INF = Long.MAX_VALUE;
//	static int INT_INF = Integer.MAX_VALUE;
//	static double PI = 3.1415926535;
//
//	private static final double EPSILON = 1e-10;
//
//	private static double dp[] = new double[MAX];

	private static Set<Integer> tree[];

	
	private static int MAXN = 300009; 
	private static int MAXA = 1000009;
//	private static int BLOCK_SZ = 555;
//	private static long answer = 0;
//	private static int frequency[] = new int[MAXA];
//	private static int arr[] = new int[MAXN];

	public static void main(String[] args) {

		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		/*

6
1 2 1
2 4 1
2 5 2
1 3 1
3 6 2
DIST 4 6
KTH 4 6 4
KTH 4 6 3
KTH 4 6 2

 		
		*/
		
			int n = in.nextInt();
			
			List<Edge> adj[] = new ArrayList[n];
			for(int i = 0; i < n; i++){
				adj[i] = new ArrayList<Edge>();
			}
			for(int i = 0; i < n - 1; i++){
				int u = in.nextInt();
				int v = in.nextInt();
				u--;
				v--;
				adj[u].add(new Edge(u, v, i));
				adj[v].add(new Edge(v, u, i));
			}
			
			int[][] pp = new int[n][22];
			long[][] cost = new long[n][22];
			
			int log2n = log(n, 2) + 1;
			
			int parent[] = new int[n];
			int level[] = new int[n];
			int size[] = new int[n];
			
			Arrays.fill(parent, -1);
			Arrays.fill(size, 1);
			boolean[] visited = new boolean[n];
			dfs(0, -1, adj, visited, parent, level, size);
//			Queue<Integer> queue = new LinkedList<Integer>();
//			queue.add(0);
//			visited[0] = true;
//			
//			while(!queue.isEmpty()){
//				int u = queue.remove();
//				for(Edge e : adj[u]){
//					if(!visited[e.v]){
//						visited[e.v] = true;
//						queue.add(e.v);
//						parent[e.v] = u;
//						level[e.v] = level[u] + 1;
//						cost[e.v][0] = e.cost;
//					}
//				}
//			}
			for(int i = 0; i < n; i++){
				pp[i][0] = parent[i];
			}
			
			for(int j = 1; j < log2n; j++){
				for(int i = 0; i < n; i++){
					if(pp[i][j - 1] != -1){
						pp[i][j] = pp[pp[i][j - 1]][j - 1];
					}
				}
			}
			
//			System.out.println(Arrays.toString(size));
			int query = in.nextInt();
			StringBuilder sb = new StringBuilder();
			for(int i = 0; i < query; i++){
				int u = in.nextInt();
				int v = in.nextInt();
				u--;
				v--;
				int lca = getLCA(n, u, v, parent, level, pp);
//				System.out.println("l" + lca);
				if(u == v){
					out.println(n);
					continue;
				}
				else if(dist(u, v, level, lca) % 2 != 0){
					out.println(0);
					continue;
				}
				else if(dist(u, lca, level, lca) == dist(v, lca, level, lca)){
					
					int x = gotoChild(u, level[u] - level[lca] - 1, log2n, pp);
					int y = gotoChild(v, level[v] - level[lca] - 1, log2n, pp);
					
				
					out.println(n - size[x] - size[y]);
					continue;
				}
				else if(level[u] < level[v]){
					int temp = u;
					u = v;
					v = temp;
				}
				
				int x = gotoChild(u, dist(u, v, level, lca) / 2, log2n, pp);
				int y = gotoChild(u, (dist(u, v, level, lca) / 2) - 1, log2n, pp);
//				System.out.println(x + " " + y);
				out.println(size[x] - size[y]);
				
			}
			
			
		out.flush();
		out.close();
		System.exit(0);
	}
	
	
	private static void dfs(int u, int p, List<Edge>[] adj, boolean[] visited, int[] parent, int[] level, int[] size) {
		parent[u] = p;
		for(Edge e: adj[u]) {
			if(e.v != p) {
				level[e.v] = level[u] + 1;
				dfs(e.v, u, adj, visited, parent, level, size);
				size[u] += size[e.v];
			}
		}
	}

	static int gotoChild(int u, int k, int log2n, int[][]pp) {
		for(int j = 0; j <= log2n && u != -1; j++) {
			if(((1 << j) & k) > 0) {
				u = pp[u][j];
			}
		}
		return u;
	}

	private static int dist(int u, int v, int[] level, int lca) {
		return level[u] + level[v] - (2 * level[lca]);
	}

	private static int getLCA(int n, int p, int q, int[] parent, int[] level, int[][] pp) {
		int log2n = log(n, 2) + 1;
		if(level[p] < level[q]){
			int temp = p;
			p = q;
			q = temp;
		}
		for(int j = log2n; j >= 0; j--){
			if ((level[p] - (1 << j)) >= level[q]) {
				p =  pp[p][j];
			}
		}
		
		if(p == q){
			return p;
		}
//		System.out.println((p + 1) + " " + (q + 1));
		
		for(int j = log2n; j >= 0; j--){
			if(pp[p][j] != pp[q][j]){
				p = pp[p][j];
				q = pp[q][j];
			}
		}
//		System.out.println(p + " " + q);
		
		return parent[p];
	}


	private static long getCost(int n, int p, int q, int[] level, long[][] cost, int[][] pp) {
		int log2n = log(n, 2) + 1;
		long sum = 0;
		if(level[p] < level[q]){
			int temp = p;
			p = q;
			q = temp;
		}
		for(int j = log2n; j >= 0; j--){
			if ((level[p] - (1 << j)) >= level[q]) {
				sum += cost[p][j];
				p =  pp[p][j];
			}
		}
		
		if(p == q){
			return sum;
		}
//		System.out.println((p + 1) + " " + (q + 1));
		
		for(int j = log2n; j >= 0; j--){
			if(pp[p][j] != pp[q][j]){
				sum += cost[p][j];
				sum += cost[q][j];
				p = pp[p][j];
				q = pp[q][j];
			}
		}
//		System.out.println(p + " " + q);
		sum += cost[p][0];
		sum += cost[q][0];
		return sum;
	}
	
	private static class Edge implements Comparable<Edge>{
		int u;
		int v;
		int cost;
		
		Edge(int u, int v, int cost){
			this.u = u;
			this.v = v;
			this.cost = cost;
		}

		@Override
		public int compareTo(Edge o) {
			
			return this.cost - o.cost;
		}
	}
	
	private static class Pair {
		int first;
		int second;

		Pair(int first, int second) {
			this.first = first;
			this.second = second;
		}
	}

	private static class Point {
		int x;
		int y;

		Point(int x, int y) {
			this.x = x;
			this.y = y;
		}

		@Override
		public String toString() {

			return this.x + " " + this.y;
		}
	}

	private static int log(int x, int base)
	{
	    return (int) (Math.log(x) / Math.log(base));
	}
	
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}

		public String next() {
			try {
				while (tokenizer == null || !tokenizer.hasMoreTokens()) {
					tokenizer = new StringTokenizer(reader.readLine());

				}
			} catch (IOException e) {
				return null;
			}
			return tokenizer.nextToken();
		}

		public String nextLine() {
			String line = null;
			try {
				tokenizer = null;
				line = reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			return line;
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public boolean hasNext() {
			try {
				while (tokenizer == null || !tokenizer.hasMoreTokens()) {
					tokenizer = new StringTokenizer(reader.readLine());
				}
			} catch (Exception e) {
				return false;
			}
			return true;
		}
	}
}

  		  		 	 						 		    	   			