#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int mo = 1000010029, p1 = 137, ni_p1 = 131388179;
char c[310000];
int Pow[310000], ni_Pow[310000], h1[310000], h2[310000];
int size[310000], dep[310000], fa[310000], dfn[310000], tim, q[310000], n, Q;
int su[310000];
vector<int> E[310000];
struct ppp {
  int x, len, s;
};
ppp make_pair(int x, int len, int s) { return ppp{x, len, s}; }
void prep(int x, int fa) {
  h1[x] = (1ll * h1[fa] * p1 + c[x]) % mo;
  h2[x] = (h2[fa] + 1ll * Pow[dep[x]] * c[x]) % mo;
  size[x] = 1;
  for (int i : E[x])
    if (i != fa) {
      dep[i] = dep[x] + 1;
      prep(i, x);
      size[x] += size[i];
    }
}
void dfs(int x, int ff) {
  fa[x] = ff;
  int maxx = -1;
  dfn[x] = ++tim;
  q[tim] = x;
  for (int i : E[x])
    if (i != ff && (maxx == -1 || size[i] > size[maxx])) maxx = i;
  if (maxx != -1) {
    su[maxx] = su[x];
    dfs(maxx, x);
  }
  for (int i : E[x])
    if (i != ff && i != maxx) {
      su[i] = i;
      dfs(i, x);
    }
}
void work(int x, int y, vector<ppp> &t, int &lca) {
  vector<ppp> tmp;
  for (;;) {
    if (su[x] == su[y]) {
      if (dfn[x] < dfn[y])
        tmp.push_back(make_pair(dfn[x], dfn[y] - dfn[x] + 1, 1)), lca = x;
      else
        t.push_back(make_pair(dfn[x], dfn[x] - dfn[y] + 1, -1)), lca = y;
      break;
    }
    if (dfn[x] > dfn[y]) {
      t.push_back(make_pair(dfn[x], dfn[x] - dfn[su[x]] + 1, -1));
      x = fa[su[x]];
    } else {
      tmp.push_back(make_pair(dfn[su[y]], dfn[y] - dfn[su[y]] + 1, 1));
      y = fa[su[y]];
    }
  }
  if (tmp.size())
    for (int i = tmp.size() - 1; i >= 0; --i) t.push_back(tmp[i]);
}
int Geth(int x, int y, int lca) {
  if (lca == -1) lca = y;
  int d1 = dep[x] - dep[lca];
  return ((h1[x] - 1ll * h1[lca] * Pow[d1] +
           1ll * (h2[y] - h2[fa[lca]]) * ni_Pow[dep[lca]] % mo * Pow[d1]) %
              mo +
          mo) %
         mo;
}
int main() {
  scanf("%d", &n);
  scanf("%s", c + 1);
  Pow[0] = 1;
  ni_Pow[0] = 1;
  for (int i = 1; i <= n; ++i) {
    Pow[i] = 1ll * Pow[i - 1] * p1 % mo;
    ni_Pow[i] = 1ll * ni_Pow[i - 1] * ni_p1 % mo;
  }
  for (int i = 1; i <= n - 1; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    E[x].push_back(y);
    E[y].push_back(x);
  }
  prep(1, 0);
  su[1] = 1;
  dfs(1, 0);
  scanf("%d", &Q);
  for (int _ = 1; _ <= Q; ++_) {
    int u, v, x, y;
    scanf("%d%d%d%d", &x, &y, &u, &v);
    vector<ppp> t1, t2;
    int lca1, lca2;
    work(x, y, t1, lca1);
    work(u, v, t2, lca2);
    int len1 = t1.size(), len2 = t2.size(), p1 = 0, p2 = 0, l1 = 0, l2 = 0,
        ans = 0, d1, d2;
    while (p1 < len1 && p2 < len2) {
      int len = min(t1[p1].len - l1, t2[p2].len - l2);
      d1 = t1[p1].s;
      d2 = t2[p2].s;
      if (Geth(x, q[t1[p1].x + (l1 + len - 1) * d1], d1 == -1 ? -1 : lca1) !=
          Geth(u, q[t2[p2].x + (l2 + len - 1) * d2], d2 == -1 ? -1 : lca2))
        break;
      l1 += len;
      l2 += len;
      if (l1 >= t1[p1].len) p1++, l1 = 0;
      if (l2 >= t2[p2].len) p2++, l2 = 0;
      ans += len;
    }
    if (p1 >= len1 || p2 >= len2) {
      printf("%d\n", ans);
      continue;
    }
    int maxlen = min(t1[p1].len - l1, t2[p2].len - l2);
    for (int i = 20; i >= 0; --i)
      if (maxlen >= 1 << i) {
        if (Geth(x, q[t1[p1].x + (l1 + (1 << i) - 1) * d1],
                 d1 == -1 ? -1 : lca1) ==
            Geth(u, q[t2[p2].x + (l2 + (1 << i) - 1) * d2],
                 d2 == -1 ? -1 : lca2)) {
          maxlen -= 1 << i;
          l1 += 1 << i;
          l2 += 1 << i;
          ans += 1 << i;
        }
      }
    printf("%d\n", ans);
  }
}
