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.
#include <bits/stdc++.h>
void dfs(int32_t vertex, int32_t parent, std::vector<int32_t>* tree,
         std::vector<int32_t>& euler, std::vector<int32_t>& euler_depths,
         int32_t depth, int32_t* depths) {
  euler.push_back(vertex);
  euler_depths.push_back(depth);
  depths[vertex] = depth;
  for (int32_t i = 0; i < tree[vertex].size(); i++)
    if (tree[vertex][i] != parent) {
      dfs(tree[vertex][i], vertex, tree, euler, euler_depths, depth + 1,
          depths);
      euler.push_back(vertex);
      euler_depths.push_back(depth);
    }
}
int32_t get_lca(int32_t v1, int32_t v2, std::vector<int32_t>& euler,
                int32_t* first_euler, int32_t** sparse_table, int32_t* depths) {
  int32_t first = first_euler[v1], second = first_euler[v2];
  if (first > second) {
    int32_t tmp = first;
    first = second;
    second = tmp;
  }
  int32_t length = second - first + 1;
  int32_t level = 0;
  while ((1 << level) <= length) level++;
  level--;
  int32_t sparse_first = sparse_table[level][first],
          sparse_second = sparse_table[level][second - (1 << level) + 1];
  return depths[euler[sparse_first]] < depths[euler[sparse_second]]
             ? euler[sparse_first]
             : euler[sparse_second];
}
void compute_subtree_sizes(int32_t vertex, int32_t parent,
                           std::vector<int32_t>* tree, int32_t* subtree_sizes) {
  subtree_sizes[vertex] = 1;
  for (int32_t i = 0; i < tree[vertex].size(); i++)
    if (tree[vertex][i] != parent) {
      compute_subtree_sizes(tree[vertex][i], vertex, tree, subtree_sizes);
      subtree_sizes[vertex] += subtree_sizes[tree[vertex][i]];
    }
}
void build_ancestors(int32_t vertex, std::vector<int32_t>* tree, int32_t parent,
                     int32_t** ancestors, int32_t* depths) {
  ancestors[vertex][0] = parent;
  for (int32_t i = 1; i < 31; i++) {
    if ((1 << i) > depths[vertex]) break;
    ancestors[vertex][i] = ancestors[ancestors[vertex][i - 1]][i - 1];
  }
  for (int32_t i = 0; i < tree[vertex].size(); i++)
    if (tree[vertex][i] != parent)
      build_ancestors(tree[vertex][i], tree, vertex, ancestors, depths);
}
int32_t get_kth_ancestor(int32_t vertex, int32_t k, int32_t** ancestors) {
  if (k == 0) return vertex;
  int32_t level = 0;
  while ((1 << level) <= k) level++;
  level--;
  if ((1 << level) == k) return ancestors[vertex][level];
  return get_kth_ancestor(ancestors[vertex][level], k - (1 << level),
                          ancestors);
}
int main() {
  int32_t n;
  std::cin >> n;
  std::vector<int32_t>* tree = new std::vector<int32_t>[n];
  for (int32_t i = 0; i < n - 1; i++) {
    int32_t src, dst;
    std::cin >> src >> dst;
    src--;
    dst--;
    tree[src].push_back(dst);
    tree[dst].push_back(src);
  }
  std::vector<int32_t> euler;
  std::vector<int32_t> euler_depths;
  int32_t* depths = new int32_t[n];
  dfs(0, -1, tree, euler, euler_depths, 0, depths);
  int32_t* first_euler = new int32_t[n];
  for (int32_t i = 0; i < n; i++) first_euler[i] = INT32_MAX;
  for (int32_t i = 0; i < euler.size(); i++)
    first_euler[euler[i]] = std::min(first_euler[euler[i]], i);
  int32_t max_level = 0;
  while ((1 << max_level) <= euler.size()) max_level++;
  max_level--;
  int32_t** sparse_table = new int32_t*[max_level + 1];
  for (int32_t i = 0; i <= max_level; i++) {
    sparse_table[i] = new int32_t[euler.size() - (1 << i) + 1];
    for (int32_t j = 0; j < euler.size() - (1 << i) + 1; j++)
      sparse_table[i][j] =
          i == 0
              ? j
              : (euler_depths[sparse_table[i - 1][j]] <
                         euler_depths[sparse_table[i - 1][j + (1 << (i - 1))]]
                     ? sparse_table[i - 1][j]
                     : sparse_table[i - 1][j + (1 << (i - 1))]);
  }
  int32_t* subtree_sizes = new int32_t[n];
  compute_subtree_sizes(0, -1, tree, subtree_sizes);
  int32_t** ancestors = new int32_t*[n];
  for (int32_t i = 0; i < n; i++) ancestors[i] = new int32_t[31];
  build_ancestors(0, tree, -1, ancestors, depths);
  int32_t num_queries;
  std::cin >> num_queries;
  for (int32_t q = 0; q < num_queries; q++) {
    int32_t v1, v2;
    std::cin >> v1 >> v2;
    v1--;
    v2--;
    if (v1 == v2) {
      std::cout << n << "\n";
      continue;
    }
    int32_t lca = get_lca(v1, v2, euler, first_euler, sparse_table, depths);
    if (depths[v1] == depths[v2]) {
      int32_t ancestor_num = depths[v1] - depths[lca] - 1;
      int32_t excluded1 = get_kth_ancestor(v1, ancestor_num, ancestors);
      int32_t excluded2 = get_kth_ancestor(v2, ancestor_num, ancestors);
      std::cout << n - subtree_sizes[excluded1] - subtree_sizes[excluded2]
                << "\n";
    } else {
      int32_t path_length = depths[v1] + depths[v2] - depths[lca] * 2;
      if (path_length % 2 == 1) {
        std::cout << 0 << "\n";
      } else {
        int32_t answer = subtree_sizes[get_kth_ancestor(
            depths[v1] > depths[v2] ? v1 : v2, path_length / 2, ancestors)];
        answer -= subtree_sizes[get_kth_ancestor(
            depths[v1] > depths[v2] ? v1 : v2, path_length / 2 - 1, ancestors)];
        std::cout << answer << "\n";
      }
    }
  }
  return 0;
}
