Problem: New Year is coming in Tree Island! In this island, as the name implies, there are n cities connected by n - 1 roads, and for any two distinct cities there always exists exactly one path between them. For every person in Tree Island, it takes exactly one minute to pass by exactly one road.

There is a weird New Year tradition for runnners in Tree Island, which is called "extreme run". This tradition can be done as follows.

A runner chooses two distinct cities a and b. For simplicity, let's denote the shortest path from city a to city b as p1, p2, ..., pl (here, p1 = a and pl = b holds). Then following happens:

  1. The runner starts at city a. 
  2. The runner runs from city a to b, following the shortest path from city a to city b. 
  3. When the runner arrives at city b, he turns his direction immediately (it takes no time), and runs towards city a, following the shortest path from city b to city a. 
  4. When the runner arrives at city a, he turns his direction immediately (it takes no time), and runs towards city b, following the shortest path from city a to city b. 
  5. Repeat step 3 and step 4 forever. 



In short, the course of the runner can be denoted as: <image> <image>

Two runners JH and JY decided to run "extremely" in order to celebrate the New Year. JH has chosen two cities u and v, and JY has chosen two cities x and y. They decided to start running at the same moment, and run until they meet at the same city for the first time. Meeting on a road doesn't matter for them. Before running, they want to know the amount of time they will run.

It is too hard for JH and JY to calculate this, so they ask you for help.

Input

The first line contains a single positive integer n (5 ≤ n ≤ 2 × 105) — the number of cities in Tree Island.

Next n - 1 lines describe the roads of Tree Island. The i-th line (1 ≤ i ≤ n - 1) of them contains two space-separated integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi) — the vertices connected by a single road of the tree.

The next line contains an integer t (1 ≤ t ≤ 2 × 105) — the number of test cases.

Next t lines describes the test cases. The j-th line (1 ≤ j ≤ t) of them contains four space-separated integers uj, vj, xj, yj (1 ≤ uj, vj, xj, yj ≤ n, uj ≠ vj, xj ≠ yj). It means that in this test case, JH has chosen two cities uj and vj, JY has chosen two cities xj and yj. JH starts running at city uj, and JY starts running at city xj.

Output

For each test case, print an integer describing the amount of time they should run in minutes. If they have to run for an infinitely long time (in other words, if they never meet at the same city), print -1 instead. If they meet at the beginning of their run, print 0.

Examples

Input

7
1 3
3 6
7 4
3 7
5 4
7 2
4
6 5 5 3
3 5 4 6
1 5 1 3
1 5 3 1


Output

2
1
0
-1

Note

The example looks like:

<image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int maxn = 200005;
const long long inf = 1LL << 60;
inline int read() {
  int res, ok = 1;
  char ch;
  for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') ok = -1;
  res = ch - '0';
  for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
    res = res * 10 + ch - '0';
  return res * ok;
}
int n, T, dis[maxn], fa[maxn][25], last[maxn], tot;
struct edge {
  int u, v, last;
} a[maxn << 1];
inline void link(int u, int v) {
  tot++;
  a[tot].u = u;
  a[tot].v = v;
  a[tot].last = last[u];
  last[u] = tot;
}
inline long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
inline long long exgcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long res = exgcd(b, a % b, y, x);
  y = y - a / b * x;
  return res;
}
inline long long work(long long t1, long long s, long long t2, long long t) {
  long long x, y, z, tmp, k;
  z = t2 - t1;
  k = exgcd(s, t, x, y);
  if (z % k) return inf;
  x *= z / k;
  y *= -z / k;
  s /= k;
  t /= k;
  if (x < 0) {
    tmp = max((-x - 1) / t + 1, (-y - 1) / s + 1);
    x += tmp * t;
    y += tmp * s;
  }
  tmp = min(x / t, y / s);
  x -= tmp * t;
  y -= tmp * s;
  return s * x * k + t1;
}
inline long long solve(long long m, long long d, long long l, long long r) {
  if (d + d > m) return solve(m, m - d, m - r, m - l);
  if ((l - 1) / d < r / d) return (l + d - 1) / d;
  long long t = solve(d, (d - m % d) % d, l % d, r % d);
  return t == inf ? inf : (l + m * t + d - 1) / d;
}
inline long long count(long long t1, long long s, long long t2, long long t,
                       long long d) {
  long long z1, z2, tmp = 0, sum;
  z1 = ((t2 - t1 - d) % t + t) % t;
  z2 = ((t2 - t1 + d) % t + t) % t;
  if (z1 & 1) return inf;
  if (t != d * 2 && z1 <= z2 && z1)
    if ((z1 - 1) / gcd(s, t) >= z2 / gcd(s, t))
      return inf;
    else
      tmp = solve(t, s % t, z1, z2);
  sum = (tmp * s + t1 + d - t2) / t;
  return (d + s * tmp + t * sum + t1 + t2) / 2;
}
inline void dfs(int x, int f) {
  for (int i = 0; fa[fa[x][i]][i]; i++) fa[x][i + 1] = fa[fa[x][i]][i];
  for (int i = last[x]; i; i = a[i].last) {
    int v = a[i].v;
    if (v != f) {
      fa[v][0] = x;
      dis[v] = dis[x] + 1;
      dfs(v, x);
    }
  }
}
inline int jump(int x, int h) {
  for (int i = 18; i >= 0; i--) {
    if (h >= (1 << i)) {
      h -= (1 << i);
      x = fa[x][i];
    }
    if (h == 0) return x;
  }
}
inline int lca(int x, int y) {
  if (dis[x] < dis[y]) swap(x, y);
  x = jump(x, dis[x] - dis[y]);
  if (x == y) return x;
  for (int i = 18; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) {
      x = fa[x][i];
      y = fa[y][i];
    }
  return fa[x][0];
}
inline long long len(int x, int y) {
  return dis[x] + dis[y] - dis[lca(x, y)] * 2;
}
inline int cmax(int x, int y) { return dis[x] > dis[y] ? x : y; }
inline long long get_ans(int x1, int y1, int x2, int y2) {
  int u, v, c1, c2;
  u = lca(x1, y1);
  v = lca(x2, y2);
  if (dis[u] > dis[v]) {
    swap(x1, x2);
    swap(y1, y2);
    swap(u, v);
  }
  if (lca(u, v) != u) return -1;
  c1 = cmax(lca(x1, x2), lca(x1, y2));
  c2 = cmax(lca(y1, x2), lca(y1, y2));
  if (max(dis[c2], dis[c1]) < dis[v]) return -1;
  c1 = cmax(c1, v);
  c2 = cmax(c2, v);
  long long s, t, d, t1, t2, t3, t4;
  s = len(x1, y1) * 2;
  t = len(x2, y2) * 2;
  d = len(c1, c2);
  t1 = len(x1, c1);
  t2 = len(x1, c2);
  t3 = len(x2, c1);
  t4 = len(x2, c2);
  if (t1 > t2)
    t1 = s - t1;
  else
    t2 = s - t2;
  if (t3 > t4)
    t3 = t - t3;
  else
    t4 = t - t4;
  long long ans = inf;
  ans = min(ans, work(t1, s, t3, t));
  ans = min(ans, work(t2, s, t4, t));
  ans = min(ans, count(t1, s, t4, t, d));
  ans = min(ans, count(t2, s, t3, t, d));
  return ans == inf ? -1 : ans;
}
int main() {
  n = read();
  for (int i = 1; i < n; i++) {
    int u, v;
    u = read();
    v = read();
    link(u, v);
    link(v, u);
  }
  dfs(1, 0);
  T = read();
  while (T--) {
    int x1, x2, y1, y2;
    x1 = read();
    y1 = read();
    x2 = read();
    y2 = read();
    printf("%I64d\n", get_ans(x1, y1, x2, y2));
  }
  return 0;
}