#include <bits/stdc++.h>
using namespace std;
int read() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || '9' < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while ('0' <= c && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return f * x;
}
const int Mod = (int)(1e9 + 7);
char S[700000 + 5];
vector<int> G[700000 + 5];
int fa[700000 + 5][22];
int p = 59, up[700000 + 5], down[700000 + 5], Powp[700000 + 5], inv[700000 + 5];
int n, dcnt, dfn[700000 + 5], siz[700000 + 5], dep[700000 + 5],
    st[22][700000 + 5];
int Add(int x, int y) {
  x += y;
  return x >= Mod ? x - Mod : x;
}
int Mul(long long x, int y) {
  x *= y;
  return x >= Mod ? x % Mod : x;
}
vector<int> e[700000], ks[700000], kf[700000];
int treedep[700000], son[700000], top[700000];
int f[21][700000];
void po1(int x, int fa, int Dep) {
  treedep[x] = Dep;
  f[0][x] = fa;
  for (int i = 0; i < (int)e[x].size(); ++i) {
    int y = e[x][i];
    if (y == fa) continue;
    po1(y, x, Dep + 1);
    if (treedep[y] > treedep[son[x]]) treedep[x] = treedep[son[x] = y];
  }
}
void po2(int x, int tp) {
  top[x] = tp;
  if (son[x]) po2(son[x], tp);
  for (int i = 0; i < (int)e[x].size(); ++i) {
    int y = e[x][i];
    if (y == f[0][x] || y == son[x]) continue;
    po2(y, y);
  }
}
int highbit[700000];
int kfa(int x, int k) {
  if (!k) return x;
  int r = highbit[k];
  x = f[r][x];
  k -= (1 << r);
  if (dep[x] - k < dep[top[x]])
    return kf[top[x]][dep[top[x]] - (dep[x] - k)];
  else
    return ks[top[x]][(dep[x] - k) - dep[top[x]]];
}
void DFS(int u) {
  dfn[u] = ++dcnt, st[0][dcnt] = u;
  up[u] = Add(Mul(p, up[fa[u][0]]), (S[u] - 'a' + 1));
  down[u] = Add(down[fa[u][0]], Mul((S[u] - 'a' + 1), Powp[dep[u]]));
  for (register int i = 0; i < (int)G[u].size(); i++) {
    register int v = G[u][i];
    if (v == fa[u][0]) continue;
    fa[v][0] = u, dep[v] = dep[u] + 1;
    DFS(v);
    st[0][++dcnt] = u;
  }
  return;
}
unsigned long long Split(int u, int v, int lca, int k) {
  k--;
  unsigned long long ret = 0;
  if (k <= dep[u] - dep[lca]) {
    int tmp = kfa(u, k);
    ret = Add(up[u], Mod - Mul(up[fa[tmp][0]], Powp[k + 1]));
  } else {
    int d = dep[u] - dep[lca], p = dep[u] + dep[v] - 2 * dep[lca] - k,
        tmp = kfa(v, p);
    k -= dep[u] - dep[lca];
    ret = Add(Add(up[u], Mod - Mul(up[lca], Powp[d])),
              Mul(Add(down[tmp], Mod - down[fa[lca][0]]),
                  Mul(inv[dep[lca]], Powp[d])));
  }
  return ret;
}
int lg2[700000 + 5];
void Prepare() {
  for (int i = 2; i <= dcnt; i++) lg2[i] = lg2[i >> 1] + 1;
  for (int i = 1; i <= 19; i++)
    for (int j = 1; j <= dcnt; j++) {
      int x = st[i - 1][j], y = st[i - 1][j + (1 << (i - 1))];
      st[i][j] = (dep[x] < dep[y] ? x : y);
    }
  for (int j = 1; j <= 19; j++)
    for (int i = 1; i <= n; i++) fa[i][j] = fa[fa[i][j - 1]][j - 1];
  return;
}
int Lca(int u, int v) {
  u = dfn[u], v = dfn[v];
  if (u > v) swap(u, v);
  int i = lg2[v - u + 1], a = st[i][u], b = st[i][v - (1 << i) + 1];
  return dep[a] < dep[b] ? a : b;
}
int Pow(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = Mul(ret, x);
    y >>= 1, x = Mul(x, x);
  }
  return ret;
}
int main() {
  n = read();
  Powp[0] = 1;
  for (int i = 1; i <= n; i++) Powp[i] = Mul(Powp[i - 1], p);
  inv[n] = Pow(Powp[n], Mod - 2);
  for (int i = n - 1; i >= 0; i--) inv[i] = Mul(inv[i + 1], p);
  scanf("%s", S + 1);
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    G[u].push_back(v), G[v].push_back(u);
    e[u].push_back(v), e[v].push_back(u);
  }
  DFS(1);
  Prepare();
  po1(1, 0, 1);
  po2(1, 1);
  for (int k = 1; k <= 20; ++k)
    for (int i = 1; i <= n; ++i) f[k][i] = f[k - 1][f[k - 1][i]];
  for (int x = 1; x <= n; ++x)
    if (x == top[x]) {
      int ns = x, nf = x;
      for (int i = 0; i <= treedep[x] - dep[x] + 1; ++i) {
        ks[x].push_back(ns), kf[x].push_back(nf);
        ns = son[ns], nf = f[0][nf];
      }
    }
  for (int i = 1; i <= n; ++i) highbit[i] = log2(i);
  int m = read();
  for (int i = 1; i <= m; i++) {
    int a = read(), b = read(), c = read(), d = read(), lca1 = Lca(a, b),
        lca2 = Lca(c, d);
    int L = 0, R = min(dep[a] + dep[b] - 2 * dep[lca1],
                       dep[c] + dep[d] - 2 * dep[lca2]) +
                   2;
    while (L + 1 < R) {
      int Mid = (L + R) >> 1;
      int tmp1 = Split(a, b, lca1, Mid);
      int tmp2 = Split(c, d, lca2, Mid);
      if (tmp1 == tmp2)
        L = Mid;
      else
        R = Mid;
    }
    printf("%d\n", L);
  }
  return 0;
}
