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.math.*;
import java.util.*;

import static java.util.Arrays.*;

public class E {
	private static final int mod = (int)1e9+7;

	final Random random = new Random(0);
	final IOFast io = new IOFast();

	/// MAIN CODE
	public void run() throws IOException {
//		int TEST_CASE = Integer.parseInt(new String(io.nextLine()).trim());
		int TEST_CASE = 1;
		while(TEST_CASE-- != 0) {
			int n = io.nextInt();
			SimpleAdjListGraph g = new SimpleAdjListGraph(n, 2*n);
			for(int i = 0; i < n - 1; i++) {
				int s = io.nextInt() - 1;
				int t = io.nextInt() - 1;
				g.addEdge(s, t);
				g.addEdge(t, s);
			}
			
			g.calcChildSize(0);
			LCA lca = new LCA(g, 0);
			int[] dist = g.bfs(0)[0];
			int[] d = new int[n + 1];
			for(int i = 0; i < dist.length; i++) {
				d[dist[i]]++;
			}
			
			int m = io.nextInt();
			for(int Q = 0; Q < m; Q++) {
				int A = io.nextInt() - 1;
				int B = io.nextInt() - 1;
				
				if(A == B) {
					io.out.println(n);
					continue;
				}
				
				if(dist[A] % 2 != dist[B] % 2) {
					io.out.println(0);
					continue;
				}
				
				if(dist[A] > dist[B]) { int t = A; A = B; B = t; }
				
				int up = lca.dist(A, B) / 2;
				int u = B;
				int A2 = A;
				int B2 = B;
				for(int i = LCA.PARENT_LOG_SIZE - 1; i >= 0; i--) {
					if((up >>> i & 1) == 1) {
						u = lca.parent[i][u];
					}
				}
				
				int ans = n;
				if(lca.lca(A, u) != u) {
					A2 = lca.parent[0][u];
					ans -= n - g.childSize[u];
				}
				else {
					for(int i = LCA.PARENT_LOG_SIZE - 1; i >= 0; i--) {
						int p = lca.parent[i][A2];
						if(p == -1) continue;
						if(lca.depth[p] > lca.depth[u]) A2 = p;
					}
					ans -= g.childSize[A2];
				}
				
				for(int i = LCA.PARENT_LOG_SIZE - 1; i >= 0; i--) {
					int p = lca.parent[i][B2];
					if(p == -1) continue;
					if(lca.depth[p] > lca.depth[u]) B2 = p;
				}
				ans -= g.childSize[B2];
				
//				System.err.println(A2 + " " + u + " " + B2 + " " + g.childSize[B2]);
				io.out.println(ans);
			}
		}
	}
	
	static
	public class LCA {
		private static final int PARENT_LOG_SIZE = 32;
		private final int[][] parent;
//		private final int[] distFromRoot;
		private final int[] depth;
		
		public int lca(int u, int v) {
			if(depth[u] > depth[v]) { final int t = u; u = v; v = t; }
			for(int k = 0; k < parent.length; k++) {
				if(((depth[v] - depth[u]) >>> k & 1) == 1) {
					v = parent[k][v];
				}
			}
			if(u == v) return u;
			for(int k = parent.length - 1; k >= 0; k--) {
				if(parent[k][u] != parent[k][v]) {
					u = parent[k][u];
					v = parent[k][v];
				}
			}
			return parent[0][u];
		}
		
		public int dist(int u, int v) {
			int w = lca(u, v);
			return depth[u] + depth[v] - 2 * depth[w];
		}
		
		/*
		public int distW(int u, int v) {
			int w = lca(u, v);
			return distFromRoot[u] + distFromRoot[v] - 2 * distFromRoot[w];
		}*/
		
		public LCA(final SimpleAdjListGraph e, int root) {
			final int N = e.head.length;
			
			parent = new int[PARENT_LOG_SIZE][N];
			depth = new int[N];
//			distFromRoot = new int[N];
			
			Arrays.fill(parent[0], -2);
			Stack<Integer> st = new Stack<Integer>();
			st.add(root);
			parent[0][root] = -1;
			while(!st.isEmpty()) {
				int v = st.pop();
				for(int u = e.head[v]; u != -1; u = e.next[u]) {
					final int t = e.to[u];
					if(parent[0][t] == -2) {
//						distFromRoot[t] = distFromRoot[v] + e.weight[u];
						depth[t] = depth[v] + 1;
						parent[0][t] = v;
						st.push(t);
					}
				}
			}
			
			for(int k = 0; k + 1 < parent.length; k++) {
				for(int v = 0; v < N; v++) {
					parent[k + 1][v] = parent[k][v] == -1 ? -1 : parent[k][parent[k][v]];
				}
			}
		}
	}

	
	static
	class SimpleAdjListGraph {
		int m, V, E;
		int[] head, next, to, childSize;

		public SimpleAdjListGraph(int V, int E) {
			head = new int[V];
			childSize = new int[V];
			next = new int[E];
			to = new int[E];
			this.V = V;
			this.E = E;
			clear();
		}

		public void clear() {
			m = 0;
			Arrays.fill(head, -1);
		}

		public void addEdge(int s, int t) {
			next[m] = head[s];
			head[s] = m;
			to[m++] = t;
		}
		
		public void calcChildSize(int root) {
			int[] st = new int[2*V+100];
			Arrays.fill(childSize, -1);
			int sp = 0;
			st[sp++] = root;
			while(sp != 0) {
				int v = st[--sp];
				if(childSize[v] == -1) {
					childSize[v] = 0;
					st[sp++] = v;
					for(int e = head[v]; e != -1; e = next[e]) {
						final int t = to[e];
						if(childSize[t] == -1) {
							st[sp++] = t;
						}
					}
				}
				else {
					for(int e = head[v]; e != -1; e = next[e]) {
						final int t = to[e];
						if(childSize[t] > 0) {
							childSize[v] += childSize[t];
						}
					}
					childSize[v]++;
				}
			}
		}
		
		public int[][] bfs(final int src) {
			final int[] dist = new int[head.length];
			final int[] prev = new int[head.length];
			final int[] q = new int[2 * head.length + 10];
			int s = 0, t = 0;
			
			Arrays.fill(dist, -1);
			Arrays.fill(prev, -1);
			dist[src] = 0;
			q[t++] = src;
			while(s != t) {
				final int v = q[s++];
				for(int e = head[v]; e != -1; e = next[e]) {
					final int u = to[e];
					if(dist[u] == -1) {
						dist[u] = dist[v] + 1;
						prev[u] = v;
						q[t++] = u;
					}
				}
			}
			return new int[][] { dist, prev };
		}

	}


	/// TEMPLATE
	static int gcd(int n, int r) { return r == 0 ? n : gcd(r, n%r); }
	static long gcd(long n, long r) { return r == 0 ? n : gcd(r, n%r); }
	
	static <T> void swap(T[] x, int i, int j) { T t = x[i]; x[i] = x[j]; x[j] = t; }
	static void swap(int[] x, int i, int j) { int t = x[i]; x[i] = x[j]; x[j] = t; }
	
	void main() throws IOException {
		//		IOFast.setFileIO("rle-size.in", "rle-size.out");
		try { run(); }
		catch (EndOfFileRuntimeException e) { }
		io.out.flush();
	}
	public static void main(String[] args) throws IOException { new E().main(); }
	
	static class EndOfFileRuntimeException extends RuntimeException {
		private static final long serialVersionUID = -8565341110209207657L; }

	static
	public class IOFast {
		private BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		private PrintWriter out = new PrintWriter(System.out);

		void setFileIn(String ins) throws IOException { in.close(); in = new BufferedReader(new FileReader(ins)); }
		void setFileOut(String outs) throws IOException { out.flush(); out.close(); out = new PrintWriter(new FileWriter(outs)); }
		void setFileIO(String ins, String outs) throws IOException { setFileIn(ins); setFileOut(outs); }

		private static int pos, readLen;
		private static final char[] buffer = new char[1024 * 8];
		private static char[] str = new char[500*8*2];
		private static boolean[] isDigit = new boolean[256];
		private static boolean[] isSpace = new boolean[256];
		private static boolean[] isLineSep = new boolean[256];

		static { for(int i = 0; i < 10; i++) { isDigit['0' + i] = true; } isDigit['-'] = true; isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true; isLineSep['\r'] = isLineSep['\n'] = true; }
		public int read() throws IOException { if(pos >= readLen) { pos = 0; readLen = in.read(buffer); if(readLen <= 0) { throw new EndOfFileRuntimeException(); } } return buffer[pos++]; }
		public int nextInt() throws IOException { int len = 0; str[len++] = nextChar(); len = reads(len, isSpace); int i = 0; int ret = 0; if(str[0] == '-') { i = 1; } for(; i < len; i++) ret = ret * 10 + str[i] - '0'; if(str[0] == '-') { ret = -ret; } return ret; }
		public long nextLong() throws IOException { int len = 0; str[len++] = nextChar(); len = reads(len, isSpace); int i = 0; long ret = 0; if(str[0] == '-') { i = 1; } for(; i < len; i++) ret = ret * 10 + str[i] - '0'; if(str[0] == '-') { ret = -ret; } return ret; }
		public char nextChar() throws IOException { while(true) { final int c = read(); if(!isSpace[c]) { return (char)c; } } }
		int reads(int len, boolean[] accept) throws IOException { try { while(true) { final int c = read(); if(accept[c]) { break; } if(str.length == len) { char[] rep = new char[str.length * 3 / 2]; System.arraycopy(str, 0, rep, 0, str.length); str = rep; } str[len++] = (char)c; } } catch(EndOfFileRuntimeException e) { ; } return len; }
		int reads(char[] cs, int len, boolean[] accept) throws IOException { try { while(true) { final int c = read(); if(accept[c]) { break; } cs[len++] = (char)c; } } catch(EndOfFileRuntimeException e) { ; } return len; }
		public char[] nextLine() throws IOException { int len = 0; str[len++] = nextChar(); len = reads(len, isLineSep); try { if(str[len-1] == '\r') { len--; read(); } } catch(EndOfFileRuntimeException e) { ; } return Arrays.copyOf(str, len); }
		public String nextString() throws IOException { return new String(next()); }
		public char[] next() throws IOException { int len = 0; str[len++] = nextChar(); len = reads(len, isSpace); return Arrays.copyOf(str, len); }
		public int next(char[] cs) throws IOException { int len = 0; cs[len++] = nextChar(); len = reads(cs, len, isSpace); return len; }
		public double nextDouble() throws IOException { return Double.parseDouble(nextString()); }
		public long[] nextLongArray(final int n) throws IOException { final long[] res = new long[n]; for(int i = 0; i < n; i++) { res[i] = nextLong(); } return res; }
		public int[] nextIntArray(final int n) throws IOException { final int[] res = new int[n]; for(int i = 0; i < n; i++) { res[i] = nextInt(); } return res; }
		public int[][] nextIntArray2D(final int n, final int k) throws IOException { final int[][] res = new int[n][]; for(int i = 0; i < n; i++) { res[i] = nextIntArray(k); } return res; }
		public int[][] nextIntArray2DWithIndex(final int n, final int k) throws IOException { final int[][] res = new int[n][k+1]; for(int i = 0; i < n; i++) { for(int j = 0; j < k; j++) { res[i][j] = nextInt(); } res[i][k] = i; } return res; }
		public double[] nextDoubleArray(final int n) throws IOException { final double[] res = new double[n]; for(int i = 0; i < n; i++) { res[i] = nextDouble(); } return res; }
	}
}
