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>
template <typename T>
class IntegerIterator {
 public:
  using value_type = T;
  using difference_type = std::ptrdiff_t;
  using pointer = T *;
  using reference = T;
  using iterator_category = std::input_iterator_tag;
  explicit IntegerIterator(T value) : value(value) {}
  IntegerIterator &operator++() {
    ++value;
    return *this;
  }
  IntegerIterator operator++(int) {
    IntegerIterator copy = *this;
    ++value;
    return copy;
  }
  IntegerIterator &operator--() {
    --value;
    return *this;
  }
  IntegerIterator operator--(int) {
    IntegerIterator copy = *this;
    --value;
    return copy;
  }
  T operator*() const { return value; }
  bool operator==(IntegerIterator rhs) const { return value == rhs.value; }
  bool operator!=(IntegerIterator rhs) const { return !(*this == rhs); }

 private:
  T value;
};
template <typename T>
class IntegerRange {
 public:
  IntegerRange(T begin, T end) : begin_(begin), end_(end) { ; }
  IntegerIterator<T> begin() const { return IntegerIterator<T>(begin_); }
  IntegerIterator<T> end() const { return IntegerIterator<T>(end_); }

 private:
  T begin_;
  T end_;
};
template <typename T>
class ReversedIntegerRange {
  using IteratorType = std::reverse_iterator<IntegerIterator<T>>;

 public:
  ReversedIntegerRange(T begin, T end) : begin_(begin), end_(end) { ; }
  IteratorType begin() const {
    return IteratorType(IntegerIterator<T>(begin_));
  }
  IteratorType end() const { return IteratorType(IntegerIterator<T>(end_)); }

 private:
  T begin_;
  T end_;
};
template <typename T>
IntegerRange<T> range(T to) {
  return IntegerRange<T>(0, to);
}
template <typename T>
IntegerRange<T> range(T from, T to) {
  return IntegerRange<T>(from, to);
}
template <typename T>
IntegerRange<T> inclusiveRange(T to) {
  return IntegerRange<T>(0, to + 1);
}
template <typename T>
IntegerRange<T> inclusiveRange(T from, T to) {
  return IntegerRange<T>(from, to + 1);
}
template <typename T>
ReversedIntegerRange<T> downrange(T from) {
  return ReversedIntegerRange<T>(from, 0);
}
template <typename T>
ReversedIntegerRange<T> downrange(T from, T to) {
  return ReversedIntegerRange<T>(from, to);
}
template <typename T>
ReversedIntegerRange<T> inclusiveDownrange(T from) {
  return ReversedIntegerRange<T>(from + 1, 0);
}
template <typename T>
ReversedIntegerRange<T> inclusiveDownrange(T from, T to) {
  return ReversedIntegerRange<T>(from + 1, to);
}
namespace impl {
using Random = std::mt19937;
}
inline impl::Random &randomEngine() {
  static std::random_device device;
  static impl::Random engine(device());
  return engine;
}
inline int randomInteger() {
  std::uniform_int_distribution<int> d;
  return d(randomEngine());
}
inline int randomInteger(int to) {
  ;
  std::uniform_int_distribution<int> d(0, to - 1);
  return d(randomEngine());
}
inline int randomInteger(int from, int to) {
  return from + randomInteger(to - from);
}
using namespace std;
class EAAndBAndLectureRooms {
  const int LOG = 20;
  vector<vector<int>> graph, P;
  vector<int> size, H;
  int dfs(int u, int p, int h) {
    H[u] = h;
    P[0][u] = p;
    int &res = size[u] = 1;
    for (int v : graph[u]) {
      if (v != p) {
        res += dfs(v, u, h + 1);
      }
    }
    return res;
  }
  void init() {
    dfs(0, 0, 0);
    int n = graph.size();
    for (int l : range(1, LOG)) {
      for (int i : range(n)) {
        P[l][i] = P[l - 1][P[l - 1][i]];
      }
    }
  }
  int lca(int u, int v) {
    if (H[u] < H[v]) {
      swap(u, v);
    }
    for (int l : downrange(LOG)) {
      if (H[P[l][u]] >= H[v]) {
        u = P[l][u];
      }
    }
    if (u == v) {
      return u;
    }
    for (int l : downrange(LOG)) {
      if (P[l][u] != P[l][v]) {
        u = P[l][u];
        v = P[l][v];
      }
    }
    return P[0][u];
  }
  int go_up(int u, int k) {
    for (int l : range(LOG)) {
      if (k & (1 << l)) {
        u = P[l][u];
      }
    }
    return u;
  }
  int dist(int u, int v) { return H[u] + H[v] - 2 * H[lca(u, v)]; }
  int solve(int u, int v) {
    if (u == v) {
      return graph.size();
    }
    int l = lca(u, v), du = H[u] - H[l], dv = H[v] - H[l], d = du + dv;
    if (d % 2) {
      return 0;
    }
    if (H[u] < H[v]) {
      swap(u, v);
      swap(du, dv);
    }
    int w = go_up(u, d / 2);
    if (du == dv) {
      return size[0] - size[go_up(u, du - 1)] - size[go_up(v, dv - 1)];
    } else {
      return size[w] - size[go_up(u, d / 2 - 1)];
    }
  }
  int brute(int u, int v) {
    int res = 0, n = graph.size();
    for (int i : range(n)) {
      if (dist(i, u) == dist(i, v)) {
        res++;
      }
    }
    return res;
  }
  vector<int> solve(const vector<pair<int, int>> &edges,
                    const vector<pair<int, int>> &queries) {
    int n = edges.size() + 1;
    graph.assign(n, {});
    size.resize(n);
    for (int i : range(1, n)) {
      int u, v;
      tie(u, v) = edges[i - 1];
      u--, v--;
      graph[u].push_back(v);
      graph[v].push_back(u);
    }
    P.assign(LOG, vector<int>(n));
    H.resize(n);
    init();
    int m = queries.size();
    vector<int> RES(m);
    for (int i : range(m)) {
      int x, y;
      tie(x, y) = queries[i];
      x--, y--;
      int res = solve(x, y);
      RES[i] = res;
    }
    return move(RES);
  }
  vector<int> brute(const vector<pair<int, int>> &edges,
                    const vector<pair<int, int>> &queries) {
    int m = queries.size();
    vector<int> res(m);
    for (int i : range(m)) {
      res[i] = brute(queries[i].first - 1, queries[i].second - 1);
    }
    return move(res);
  }

 public:
  void solve(std::istream &in, std::ostream &out) {
    int n;
    in >> n;
    vector<pair<int, int>> edges(n - 1);
    for (auto &ed : edges) {
      in >> ed.first >> ed.second;
    }
    int m;
    in >> m;
    vector<pair<int, int>> queries(m);
    for (auto &q : queries) {
      in >> q.first >> q.second;
    }
    vector<int> res = solve(edges, queries);
    for (int x : res) {
      out << x << "\n";
    }
  }
  const int N = 8;
  void setup() {}
};
int main() {
  std::ios_base::sync_with_stdio(false);
  EAAndBAndLectureRooms solver;
  solver.setup();
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  in.tie(nullptr);
  out << std::fixed;
  out.precision(20);
  solver.solve(in, out);
  return 0;
}
