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 INF = 0x3f3f3f3f3f3f;
int n, q;
vector<int> T[200005];
int dep[200005], pre[200005][20];
void dfs(int v) {
  for (int i = 1; i <= (int)(17); i++) pre[v][i] = pre[pre[v][i - 1]][i - 1];
  for (int i = 0; i < (int)(T[v].size()); i++) {
    int u = T[v][i];
    if (u == pre[v][0]) continue;
    pre[u][0] = v;
    dep[u] = dep[v] + 1;
    dfs(u);
  }
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 17; i >= 0; i--)
    if ((dep[x] - dep[y]) >> i) x = pre[x][i];
  if (x == y) return x;
  for (int i = 17; i >= 0; i--)
    if (pre[x][i] != pre[y][i]) {
      x = pre[x][i];
      y = pre[y][i];
    }
  return pre[x][0];
}
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int exgcd(int x, int y, int& u, int& v) {
  if (y == 0) {
    u = 1;
    v = 0;
    return x;
  }
  int ret = exgcd(y, x % y, v, u);
  v -= u * (x / y);
  return ret;
}
long long calc(int m0, int m1, int r0, int r1) {
  int u, v;
  int g = exgcd(m0, m1, u, v);
  if ((r0 - r1) % g != 0) return INF;
  long long ret = (1LL * r0 * v * m1 + 1LL * r1 * u * m0) / g,
            cyc = 1LL * m0 * m1 / g;
  ret %= cyc;
  if (ret < 0) ret += cyc;
  return ret;
}
long long minz(long long beg, long long st, long long m, long long cnt) {
  if (beg + st * (cnt - 1) < m) return beg;
  if (st * 2 > m) return minz((beg + st * (cnt - 1)) % m, m - st, m, cnt);
  long long t = beg < st ? 0 : (m - beg - 1) / st + 1;
  beg = (beg + st * t) % m;
  cnt -= t;
  return minz(beg, (st - m % st) % st, st, (beg + (cnt - 1) * st) / m + 1);
}
long long calc(int l0, int l1, int p0, int q0, int p1, int q1) {
  if ((p0 - p1) & 1) return INF;
  if (q0 - p0 == q1 - p1)
    return min(calc(l0, l1, p0, p1), calc(l0, l1, q0, q1));
  if (p0 > q0) {
    swap(p0, q0);
    swap(p1, q1);
  }
  int g = gcd(l0, l1);
  int c = ((p1 - p0) % g + g) % g / 2;
  p0 += c;
  p1 -= c;
  if (p0 > q0) return INF;
  int len = (q0 - p0) / (g / 2) + 1;
  long long beg = calc(l0, l1, p0, p1), st = calc(l0, l1, g / 2, l1 - g / 2),
            cyc = 1LL * l0 * l1 / g;
  return minz(beg, st, cyc, len);
}
int l0, p0, q0, l1, p1, q1;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (int)(n - 1); i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    T[u].push_back(v);
    T[v].push_back(u);
  }
  dfs(1);
  scanf("%d", &q);
  for (int i = 0; i < (int)(q); i++) {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    int x = lca(a, b), y = lca(c, d);
    if (dep[x] > dep[y]) {
      swap(x, y);
      swap(a, c);
      swap(b, d);
    }
    l0 = dep[a] + dep[b] - 2 * dep[x];
    l1 = dep[c] + dep[d] - 2 * dep[y];
    if (x == y) {
      int ac = lca(a, c), bd = lca(b, d), ad = lca(a, d), bc = lca(b, c);
      if (ac != x || bd != x) {
        p0 = dep[a] - dep[ac];
        q0 = dep[bd] + dep[a] - 2 * dep[x];
        p1 = dep[c] - dep[ac];
        q1 = dep[bd] + dep[c] - 2 * dep[x];
      } else if (ad != x || bc != x) {
        p0 = dep[a] - dep[ad];
        q0 = dep[bc] + dep[a] - 2 * dep[x];
        p1 = dep[ad] + dep[c] - 2 * dep[x];
        q1 = dep[c] - dep[bc];
      } else {
        p0 = q0 = dep[a] - dep[x];
        p1 = q1 = dep[c] - dep[x];
      }
    } else {
      int ay = lca(a, y), by = lca(b, y);
      if (ay == y) {
        int ac = lca(a, c), ad = lca(a, d);
        if (ac != y) {
          p0 = dep[a] - dep[ac];
          q0 = dep[a] - dep[y];
          p1 = dep[c] - dep[ac];
          q1 = dep[c] - dep[y];
        } else if (ad != y) {
          p0 = dep[a] - dep[ad];
          q0 = dep[a] - dep[y];
          p1 = dep[c] + dep[ad] - 2 * dep[y];
          q1 = dep[c] - dep[y];
        } else {
          p0 = q0 = dep[a] - dep[y];
          p1 = q1 = dep[c] - dep[y];
        }
      } else if (by == y) {
        int bc = lca(b, c), bd = lca(b, d);
        if (bc != y) {
          p0 = dep[a] + dep[y] - 2 * dep[x];
          q0 = dep[a] + dep[bc] - 2 * dep[x];
          p1 = dep[c] - dep[y];
          q1 = dep[c] - dep[bc];
        } else if (bd != y) {
          p0 = dep[a] + dep[y] - 2 * dep[x];
          q0 = dep[a] + dep[bd] - 2 * dep[x];
          p1 = dep[c] - dep[y];
          q1 = dep[c] + dep[bd] - 2 * dep[y];
        } else {
          p0 = q0 = dep[a] + dep[y] - 2 * dep[x];
          p1 = q1 = dep[c] - dep[y];
        }
      } else {
        printf("-1\n");
        continue;
      }
    }
    long long ans = INF;
    ans = min(ans, calc(2 * l0, 2 * l1, p0, q0, p1, q1));
    ans = min(ans, calc(2 * l0, 2 * l1, 2 * l0 - p0, 2 * l0 - q0, p1, q1));
    ans = min(ans, calc(2 * l0, 2 * l1, p0, q0, 2 * l1 - p1, 2 * l1 - q1));
    ans = min(ans, calc(2 * l0, 2 * l1, 2 * l0 - p0, 2 * l0 - q0, 2 * l1 - p1,
                        2 * l1 - q1));
    printf("%lld\n", ans == INF ? -1 : ans);
  }
  return 0;
}