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.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.InputMismatchException;

public class TaskE {

	public FasterScanner mFScanner;
	public PrintWriter mOut;
	private int N, Q, mLog;
	private ArrayList<Integer> mAdj[];
	private int mTree[];
	private int mSize[];
	private int mLevel[];
	private int mLCA[][];

	public TaskE() {
		mFScanner = new FasterScanner();
		mOut = new PrintWriter(System.out);
	}

	public void solve() {
		int i;
		int u, v;
		
		N = mFScanner.nextInt();

		for (mLog = 0; (1L << mLog) <= N; mLog++)
			;
		
		mAdj = new ArrayList[N];
		mSize = new int[N];
		mLevel = new int[N];
		mTree = new int[N];
		mLCA = new int[N][mLog];
		
		for (i = 0; i < N; i++) {
			mAdj[i] = new ArrayList<Integer>();
		}
		
		for (i = 0; i < N - 1; i++) {
			u = mFScanner.nextInt() - 1;
			v = mFScanner.nextInt() - 1;
			mAdj[u].add(v);
			mAdj[v].add(u);
		}
		
		dfs(0, -1, 0);
		preprocess();
		
		Q = mFScanner.nextInt();
		
		while (Q-- > 0) {
			u = mFScanner.nextInt() - 1;
			v = mFScanner.nextInt() - 1;
			solveSubQuery(u, v);
		}

	}
	
	public void solveSubQuery(int u, int v) {
		int lca;
		int edges;
		int levelUp;
		int res;
		
		lca = lca(u, v);
		edges = mLevel[u] + mLevel[v] - 2 * mLevel[lca];
		
		if (edges % 2 == 1) {
			mOut.println(0);
			return;
		}
		
		if (u == v) {
			mOut.println(N);
			return;
		}
		
		levelUp = edges / 2;
		
		if (mLevel[u] == mLevel[v]) {
			levelUp--;
			u = upLevelNode(u, levelUp);
			v = upLevelNode(v, levelUp);
			
			res = mSize[0] - mSize[u] - mSize[v];
		} else {
			if (mLevel[u] < mLevel[v]) {
				u ^= v;
				v ^= u;
				u ^= v;
			}
			
			int node = upLevelNode(u, levelUp);
			res = mSize[node];
			node = upLevelNode(u, levelUp - 1);
			res -= mSize[node];
		}
		
		mOut.println(res);
	}
	
	public void preprocess() {

		for (int i = 0; i < mLog; i++)
			for (int j = 0; j < N; j++)
				mLCA[j][i] = -1;

		for (int i = 0; i < mLog; i++) {
			for (int j = 0; j < N; j++) {
				if (i == 0) {
					mLCA[j][0] = mTree[j];
				} else if (mLCA[j][i - 1] != -1) {
					mLCA[j][i] = mLCA[mLCA[j][i - 1]][i - 1];
				}
			}
		}
	}
	
	public int upLevelNode(int u, int levelUp) {
		
		int i;
		int log;
		
		for (log = 0; (1 << log) <= levelUp; log++)
			;
		log--;
		
		for (i = log; i >= 0; i--) {
			if (levelUp - (1 << i) >= 0) {
				u = mLCA[u][i];
				levelUp -= (1 << i);
			}
		}
		
		return u;
	}
	
	public int lca(int u, int v) {
		int i;
		int log;

		if (mLevel[u] < mLevel[v]) {
			u ^= v;
			v ^= u;
			u ^= v;
		}

		for (log = 0; (1 << log) <= mLevel[u]; log++)
			;
		log--;

		for (i = log; i >= 0; i--) {
			if (mLevel[u] - (1 << i) >= mLevel[v]) {
				u = mLCA[u][i];
			}
		}

		if (u == v)
			return u;

		for (i = log; i >= 0; i--) {
			if (mLCA[u][i] != -1 && mLCA[u][i] != mLCA[v][i]) {
				u = mLCA[u][i];
				v = mLCA[v][i];
			}
		}

		return mTree[u];
	}
	
	public int dfs(int node, int parent, int level) {
		
		int size = 1;
		
		for (int u : mAdj[node]) {
			if (u != parent) {
				size += dfs(u, node, level + 1);
			}
		}
		
		mSize[node] = size;
		mLevel[node] = level;
		mTree[node] = parent;
		
		return size;
	}

	public void flush() {
		mOut.flush();
	}

	public void close() {
		mOut.close();
	}

	public static void main(String[] args) {
		TaskE mSol = new TaskE();
		mSol.solve();
		mSol.flush();
		mSol.close();
	}

	class FasterScanner {
		private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FasterScanner() {
			this(System.in);
		}

		public FasterScanner(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

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

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public char[] nextCharArray(int N) {
			int i;
			char[] array;
			String str;

			array = new char[N];

			i = 0;

			str = nextLine();

			for (i = 0; i < N && i < str.length(); i++) {
				array[i] = str.charAt(i);
			}

			return array;
		}

		public char[][] nextChar2DArray(int M, int N) {
			int i;
			char[][] array;

			array = new char[M][N];

			i = 0;

			for (i = 0; i < M; i++) {
				array[i] = nextCharArray(N);
			}

			return array;
		}

		public int[] nextIntArray(int N) {
			int i;
			int[] array;

			array = new int[N];

			i = 0;

			for (i = 0; i < N; i++) {
				array[i] = nextInt();
			}

			return array;
		}

		public int[][] nextInt2DArray(int M, int N) {
			int i;
			int[][] array;

			array = new int[M][N];

			i = 0;

			for (i = 0; i < M; i++) {
				array[i] = nextIntArray(N);
			}

			return array;
		}

		public long[] nextLongArray(int N) {
			int i;
			long[] array;

			array = new long[N];

			i = 0;

			for (i = 0; i < N; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public long[][] nextLong2DArray(int M, int N) {
			int i;
			long[][] array;

			array = new long[M][N];

			i = 0;

			for (i = 0; i < M; i++) {
				array[i] = nextLongArray(N);
			}

			return array;
		}

		public double[] nextDoubleArray(int N) {
			int i;
			double[] array;

			array = new double[N];

			for (i = 0; i < N; i++) {
				array[i] = nextDouble();
			}

			return array;
		}

		public double[][] nextDouble2DArray(int M, int N) {
			int i;
			double[][] array;

			array = new double[M][N];

			for (i = 0; i < M; i++) {
				array[i] = nextDoubleArray(N);
			}

			return array;
		}

	}
}