#include <bits/stdc++.h>
const int b1 = 17, b2 = 23, mod = 1e9 + 7, mod2 = 998244353;
int fa[300005], d[300005], anc[300005][21], pw1[300005], pw2[300005],
    ipw1[300005], ipw2[300005], up1[300005], up2[300005], down1[300005],
    down2[300005], son[300005], top[300005], h[300005], lg[300005], n, q;
char s[300005];
std::vector<int> ch[300005], up[300005], down[300005];
int qpow(int a, int b, int M) {
  if (b == 0) return 1;
  long long d = qpow(a, b >> 1, M);
  d = d * d % M;
  if (b & 1) d = d * a % M;
  return d;
}
int dec(int x, int M) { return x >= M ? x - M : x; }
void dfs(int u, int f) {
  fa[u] = f;
  d[u] = d[fa[u]] + 1;
  h[u] = 1;
  anc[u][0] = fa[u];
  down1[u] = ((long long)down1[fa[u]] * b1 % mod + s[u] - 'a') % mod;
  down2[u] = ((long long)down2[fa[u]] * b2 % mod2 + s[u] - 'a') % mod2;
  up1[u] = dec(up1[fa[u]] + (long long)(s[u] - 'a') * pw1[d[u]] % mod, mod);
  up2[u] = dec(up2[fa[u]] + (long long)(s[u] - 'a') * pw2[d[u]] % mod2, mod2);
  for (int i = 1; anc[u][i - 1] && i <= 20; ++i)
    anc[u][i] = anc[anc[u][i - 1]][i - 1];
  for (int v : ch[u]) {
    if (v == f) continue;
    dfs(v, u);
    h[u] = std::max(h[v] + 1, h[u]);
    if (h[v] > h[son[u]]) son[u] = v;
  }
}
void dfs1(int u, int tp) {
  top[u] = tp;
  if (u == tp) {
    for (int i = 1, x = u; i <= h[u]; ++i) {
      up[u].push_back(x);
      x = fa[x];
    }
    for (int i = 1, x = u; i <= h[u]; ++i) {
      down[u].push_back(x);
      x = son[x];
    }
  }
  for (int v : ch[u])
    if (v != fa[u]) dfs1(v, son[u] == v ? tp : v);
}
int lca(int u, int v) {
  if (d[u] < d[v]) std::swap(u, v);
  for (int i = lg[d[u]]; i >= 0; i--)
    if (d[anc[u][i]] >= d[v]) u = anc[u][i];
  if (u == v) return u;
  for (int i = lg[d[u]]; i >= 0; i--)
    if (anc[u][i] != anc[v][i]) {
      u = anc[u][i];
      v = anc[v][i];
    }
  return anc[u][0];
}
int lift(int x, int k) {
  if (!k) return x;
  int u = anc[x][lg[k]];
  k -= (1 << lg[k]) + d[u] - d[top[u]];
  return k >= 0 ? up[top[u]][k] : down[top[u]][-k];
}
std::pair<int, int> hash(int x, int l, int y, int len) {
  if (len <= d[x] - d[l] + 1) {
    int p = lift(x, len - 1);
    return std::make_pair(
        (long long)dec(up1[x] - up1[fa[p]] + mod, mod) * ipw1[d[p]] % mod,
        (long long)dec(up2[x] - up2[fa[p]] + mod2, mod2) * ipw2[d[p]] % mod2);
  } else {
    len -= (d[x] - d[l] + 1);
    int p = lift(y, d[y] - d[l] - len);
    return std::make_pair(
        dec((long long)dec(up1[x] - up1[fa[l]] + mod, mod) * ipw1[d[l]] % mod *
                    pw1[len] % mod +
                dec(down1[p] - ((long long)down1[l] * pw1[len] % mod) + mod,
                    mod),
            mod),
        dec((long long)dec(up2[x] - up2[fa[l]] + mod2, mod2) * ipw2[d[l]] %
                    mod2 * pw2[len] % mod2 +
                dec(down2[p] - ((long long)down2[l] * pw2[len] % mod2) + mod2,
                    mod2),
            mod2));
  }
}
int read() {
  char c = getchar();
  int x = 0;
  while (c < '0' || c > '9') c = getchar();
  while ('0' <= c && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x;
}
int main() {
  scanf("%d%s", &n, s + 1);
  lg[0] = -1;
  pw1[0] = pw2[0] = ipw1[0] = ipw2[0] = 1;
  int inv1 = qpow(b1, mod - 2, mod);
  int inv2 = qpow(b2, mod2 - 2, mod2);
  for (int i = 1; i <= n; ++i) {
    pw1[i] = (long long)pw1[i - 1] * b1 % mod;
    pw2[i] = (long long)pw2[i - 1] * b2 % mod2;
    ipw1[i] = (long long)ipw1[i - 1] * inv1 % mod;
    ipw2[i] = (long long)ipw2[i - 1] * inv2 % mod2;
    lg[i] = lg[i / 2] + 1;
  }
  for (int i = 1; i < n; ++i) {
    int u, v;
    u = read();
    v = read();
    ch[u].push_back(v);
    ch[v].push_back(u);
  }
  dfs(1, 0);
  dfs1(1, 1);
  scanf("%d", &q);
  while (q--) {
    int a1, b1, a2, b2;
    a1 = read();
    b1 = read();
    a2 = read();
    b2 = read();
    int l1 = lca(a1, b1), l2 = lca(a2, b2);
    int d1 = d[a1] + d[b1] - 2 * d[l1] + 1;
    int d2 = d[a2] + d[b2] - 2 * d[l2] + 1;
    int l = 1, r = std::min(d1, d2), ans = 0;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (hash(a1, l1, b1, mid) == hash(a2, l2, b2, mid)) {
        ans = mid;
        l = mid + 1;
      } else
        r = mid - 1;
    }
    printf("%d\n", ans);
  }
  return 0;
}
