#include <bits/stdc++.h>
using namespace std;
char c[300009];
int pw[300009], ni_pw[300009], h1[300009], h2[300009], size[300009],
    dep[300009], fa[300009], dw[300009], tim, q[300009], n, Q, su[300009];
const int mo = 1000010029, p1 = 137, ni_p1 = 131388179;
vector<int> g[300009];
struct V {
  int x, len, s;
};
void prep(int x, int fa) {
  h1[x] = (1ll * h1[fa] * p1 + c[x]) % mo,
  h2[x] = (h2[fa] + 1ll * pw[dep[x]] * c[x]) % mo, size[x] = 1;
  for (int i : g[x])
    if (i != fa) dep[i] = dep[x] + 1, prep(i, x), size[x] += size[i];
}
void dfs(int x, int ff) {
  int maxx = -1;
  fa[x] = ff, dw[x] = ++tim, q[tim] = x;
  for (int i : g[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 : g[x])
    if (i != ff && i != maxx) su[i] = i, dfs(i, x);
}
void take(int x, int y, vector<V> &t, int &lca) {
  vector<V> tmp;
  while (1) {
    if (su[x] == su[y]) {
      if (dw[x] < dw[y])
        tmp.push_back(V{dw[x], dw[y] - dw[x] + 1, 1}), lca = x;
      else
        t.push_back(V{dw[x], dw[x] - dw[y] + 1, -1}), lca = y;
      break;
    }
    if (dw[x] > dw[y])
      t.push_back(V{dw[x], dw[x] - dw[su[x]] + 1, -1}), x = fa[su[x]];
    else
      tmp.push_back(V{dw[su[y]], dw[y] - dw[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 gt(int x, int y, int lca) {
  if (lca == -1) lca = y;
  int d1 = dep[x] - dep[lca];
  return ((h1[x] - 1ll * h1[lca] * pw[d1] +
           1ll * (h2[y] - h2[fa[lca]]) * ni_pw[dep[lca]] % mo * pw[d1]) %
              mo +
          mo) %
         mo;
}
int main() {
  pw[0] = 1, ni_pw[0] = 1;
  scanf("%d", &n);
  scanf("%s", c + 1);
  for (int i = 1; i <= n; i++)
    pw[i] = 1ll * pw[i - 1] * p1 % mo,
    ni_pw[i] = 1ll * ni_pw[i - 1] * ni_p1 % mo;
  for (int i = 1, x, y; i < n; i++)
    scanf("%d%d", &x, &y), g[x].push_back(y), g[y].push_back(x);
  prep(1, 0), su[1] = 1, dfs(1, 0);
  scanf("%d", &Q);
  while (Q--) {
    int u, v, x, y;
    scanf("%d%d%d%d", &x, &y, &u, &v);
    vector<V> t1, t2;
    int lca1, lca2;
    take(x, y, t1, lca1), take(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 (gt(x, q[t1[p1].x + (l1 + len - 1) * d1], d1 == -1 ? -1 : lca1) !=
          gt(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 (gt(x, q[t1[p1].x + (l1 + (1 << i) - 1) * d1],
               d1 == -1 ? -1 : lca1) ==
            gt(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);
  }
}
