#include <bits/stdc++.h>
using namespace std;
char s[300000 + 5], ss[300000 * 10 + 5];
struct edge {
  int nx, t;
} e[300000 * 2 + 5];
int h[300000 + 5], en, fa[19][300000 + 5], d[300000 + 5];
int t[300000 + 5], mx[300000 + 5], f[300000 + 5], o[300000 + 5];
int p[300000 + 5], r[300000 + 5], a[300000 + 5], b[300000 + 5], sn;
vector<int> v1[300000 + 5], v2[300000 + 5];
void ins(int x, int y) {
  e[++en] = (edge){h[x], y}, h[x] = en;
  e[++en] = (edge){h[y], x}, h[y] = en;
}
void dfs(int x) {
  a[x] = (a[fa[0][x]] + 1LL * s[x] * p[d[x]]) % 998244353;
  b[x] = (233LL * b[fa[0][x]] + s[x]) % 998244353;
  for (int i = h[x]; i; i = e[i].nx)
    if (e[i].t != fa[0][x]) {
      fa[0][e[i].t] = x;
      d[e[i].t] = d[x] + 1;
      dfs(e[i].t);
      if (t[e[i].t] + 1 > t[x]) t[x] = t[e[i].t] + 1, mx[x] = e[i].t;
    }
}
void build(int x) {
  if (!f[x]) {
    f[x] = x;
    for (int i = 0, j = x; i < t[x]; ++i, j = fa[0][j]) v2[x].push_back(j);
  }
  v1[f[x]].push_back(x);
  if (mx[x]) f[mx[x]] = f[x];
  for (int i = h[x]; i; i = e[i].nx)
    if (e[i].t != fa[0][x]) build(e[i].t);
}
int up(int x, int k) {
  if (k <= d[x] - d[f[x]]) return v1[f[x]][d[x] - d[f[x]] - k];
  x = fa[o[k]][x], k -= 1 << o[k];
  if (k <= d[x] - d[f[x]]) return v1[f[x]][d[x] - d[f[x]] - k];
  return v2[f[x]][k - d[x] + d[f[x]]];
}
int lca(int x, int y) {
  if (d[x] < d[y]) swap(x, y);
  x = up(x, d[x] - d[y]);
  if (x == y) return x;
  for (int i = 19; i--;)
    if (fa[i][x] != fa[i][y]) x = fa[i][x], y = fa[i][y];
  return fa[0][x];
}
int inv(int x) {
  int r = 1, y = 998244353 - 2;
  for (; y; y >>= 1, x = 1LL * x * x % 998244353)
    if (y & 1) r = 1LL * r * x % 998244353;
  return r;
}
int cala(int x, int y) {
  return 1LL * (a[x] + 998244353 - a[fa[0][y]]) * r[d[y]] % 998244353;
}
int calb(int x, int y) {
  return (b[x] + 998244353 - 1LL * b[y] * p[d[x] - d[y]] % 998244353) %
         998244353;
}
int cal(int x, int y, int l, int z) {
  if (z <= d[x] - d[l]) return cala(x, up(x, z));
  y = up(y, d[x] + d[y] - 2 * d[l] - z);
  return (1LL * cala(x, l) * p[d[y] - d[l]] + calb(y, l)) % 998244353;
}
int main() {
  int n, i, j, x1, x2, y1, y2, l1, l2, ll, rr, ans;
  scanf("%d", &n);
  for (i = 2; i <= n; ++i) o[i] = o[i >> 1] + 1;
  scanf("%s", s + 1);
  for (i = 1; i < n; ++i) scanf("%d%d", &ll, &rr), ins(ll, rr);
  for (p[0] = i = 1; i <= n; ++i) p[i] = 233LL * p[i - 1] % 998244353;
  for (r[i = n] = inv(p[n]); i--;) r[i] = 233LL * r[i + 1] % 998244353;
  dfs(1);
  build(1);
  for (i = 1; i < 19; ++i)
    for (j = 1; j <= n; ++j) fa[i][j] = fa[i - 1][fa[i - 1][j]];
  for (scanf("%d", &i); i--;) {
    scanf("%d%d", &x1, &y1);
    l1 = lca(x1, y1);
    scanf("%d%d", &x2, &y2);
    l2 = lca(x2, y2);
    ans = ll = 0;
    rr = min(d[x1] + d[y1] - 2 * d[l1], d[x2] + d[y2] - 2 * d[l2]);
    while (ll <= rr) {
      int mid = (ll + rr) >> 1;
      if (cal(x1, y1, l1, mid) == cal(x2, y2, l2, mid))
        ans = ll = mid + 1;
      else
        rr = mid - 1;
    }
    printf("%d\n", ans);
  }
}
