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>
const int maxn = 200001, maxf = 19;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
int n, q, tot, lnk[maxn], dep[maxn], fa[maxn][maxf];
struct Edge {
  int v, nxt;
} e[maxn << 1];
template <class T>
void swap(T& x, T& y) {
  const T t = x;
  x = y;
  y = t;
}
template <class T>
const T& min(const T& x, const T& y) {
  return x < y ? x : y;
}
void dfs(int u) {
  for (int it = lnk[u]; it; it = e[it].nxt) {
    int& v = e[it].v;
    if (v == fa[u][0]) continue;
    dep[v] = dep[u] + 1;
    fa[v][0] = u;
    for (int i = 1; fa[v][i - 1]; ++i) fa[v][i] = fa[fa[v][i - 1]][i - 1];
    dfs(v);
  }
}
int deeper(int u, int v) { return dep[u] < dep[v] ? v : u; }
int lca(int u, int v) {
  if (dep[u] > dep[v]) swap(u, v);
  for (int i = 0, j = dep[v] - dep[u]; j; ++i, j >>= 1)
    if (j & 1) v = fa[v][i];
  if (u == v) return u;
  for (int i = maxf - 1; i >= 0; --i)
    if (fa[u][i] != fa[v][i]) {
      u = fa[u][i];
      v = fa[v][i];
    }
  return fa[u][0];
}
int dist(int u, int v) { return dep[u] + dep[v] - (dep[lca(u, v)] << 1); }
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
void exgcd(int a, int b, int& x, int& y) {
  if (!b) {
    x = 1;
    y = 0;
    return;
  }
  exgcd(b, a % b, y, x);
  y -= x * (a / b);
}
long long Case1(int t1, int d1, int t2, int d2) {
  int g = gcd(t1, t2), r = (d2 - d1) % t2;
  if (r < 0) r += t2;
  if (r % g != 0) return INF;
  int x, y;
  t1 /= g;
  t2 /= g;
  r /= g;
  exgcd(t1, t2, x, y);
  if (x < 0) x += t2;
  x = (long long)x * r % t2;
  return (long long)x * t1 * g + d1;
}
long long AMAC(int m, int d, int l, int r) {
  if (l % d == 0) return l / d;
  if (l / d != r / d) return l / d + 1;
  int g = gcd(m, d);
  if (l % g != 0 && l / g == r / g) return -1;
  long long res = AMAC(d, m % d, -r % d + d, -l % d + d);
  if (res == -1) return -1;
  return (res * m + l - 1) / d + 1;
}
long long Case2(int t1, int d1, int t2, int d2, int dd) {
  int m = t2, d = t1, l = (d2 - d1 - dd) % t2, r = (d2 - d1 + dd) % t2;
  if (l < 0) l += t2;
  if (r < 0) r += t2;
  if (l & 1) return INF;
  if (t2 == dd * 2 || l > r || l == 0) return d1 + r / 2;
  if (!(d %= m)) return INF;
  long long res = AMAC(m, d, l, r);
  if (res == -1) return INF;
  return t1 * res + d1 + dd - (t1 * res % t2 - l) / 2;
}
int main() {
  scanf("%d", &n);
  for (int i = 1, u, v; i < n; ++i) {
    scanf("%d%d", &u, &v);
    e[++tot] = (Edge){v, lnk[u]};
    lnk[u] = tot;
    e[++tot] = (Edge){u, lnk[v]};
    lnk[v] = tot;
  }
  dfs(1);
  scanf("%d", &q);
  while (q--) {
    int u, v, x, y;
    scanf("%d%d%d%d", &u, &v, &x, &y);
    int px = deeper(lca(u, x), lca(v, x));
    int py = deeper(lca(u, y), lca(v, y));
    int pp = deeper(lca(u, v), lca(x, y));
    if (dep[px] < dep[pp] && dep[py] < dep[pp]) {
      puts("-1");
      continue;
    }
    if (dep[px] < dep[pp])
      px = pp;
    else if (dep[py] < dep[pp])
      py = pp;
    int f1 = dist(u, v) << 1, f2 = dist(x, y) << 1, d = dist(px, py);
    int t1 = dist(u, px), t2 = dist(u, py), t3 = dist(x, px), t4 = dist(x, py);
    if (t1 <= t2)
      t2 = f1 - t2;
    else
      t1 = f1 - t1;
    if (t3 <= t4)
      t4 = f2 - t4;
    else
      t3 = f2 - t3;
    long long ans = min(min(Case1(f1, t1, f2, t3), Case2(f1, t1, f2, t4, d)),
                        min(Case1(f1, t2, f2, t4), Case2(f1, t2, f2, t3, d)));
    if (ans == INF)
      puts("-1");
    else
      printf("%I64d\n", ans);
  }
  return 0;
}