#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5, P = 998244353;
int n, m, dep[N], top[N], dfn[N], s[N], son[N], fa[N], dfc, idfn[N], p[N];
int sid[N], pid[N], pre[N], suf[N];
vector<int> e[N];
char str[N];
void dfs1(int u) {
  s[u] = 1, dep[u] = dep[fa[u]] + 1;
  for (auto v : e[u]) {
    if (v == fa[u]) continue;
    fa[v] = u;
    dfs1(v);
    s[u] += s[v];
    if (s[v] > s[son[u]]) son[u] = v;
  }
}
void dfs2(int u, int topf) {
  dfn[u] = ++dfc, idfn[dfc] = u, top[u] = topf;
  if (!son[u]) {
    return;
  }
  dfs2(son[u], topf);
  for (auto v : e[u])
    if (v != fa[u] && v != son[u]) dfs2(v, v);
}
inline int ask(int l, int r) {
  int res;
  if (l <= r)
    res = (pre[r] - 1ll * pre[l - 1] * p[r - l + 1] % P + P) % P;
  else
    res = (suf[r] - 1ll * suf[l + 1] * p[l - r + 1] % P + P) % P;
  return res;
}
int LCA(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    x = fa[top[x]];
  }
  return dep[x] > dep[y] ? y : x;
}
int jump(int x, int y) {
  while (dfn[x] - dfn[top[x]] + 1 <= y)
    y -= dfn[x] - dfn[top[x]] + 1, x = fa[top[x]];
  return idfn[dfn[x] - y];
}
inline int qry(int x, int y, int k) {
  if (k == 0) return 0;
  if (x == y) return str[x] - 'a';
  int lca = LCA(x, y), now = 0, res = 0;
  bool ok = 0;
  if (x == lca) ok = 1;
  int temp = lca;
  if (!ok) lca = jump(x, dep[x] - dep[lca] - 1);
  while (top[x] != top[lca]) {
    if (now + dfn[x] - dfn[top[x]] + 1 >= k) {
      res = (1ll * res * p[k - now] + ask(dfn[x], dfn[x] - (k - now) + 1)) % P;
      return res;
    } else {
      res =
          (1ll * res * p[dfn[x] - dfn[top[x]] + 1] + ask(dfn[x], dfn[top[x]])) %
          P;
      now += dfn[x] - dfn[top[x]] + 1;
    }
    x = fa[top[x]];
  }
  if (now + dfn[x] - dfn[lca] + 1 >= k) {
    res = (1ll * res * p[k - now] + ask(dfn[x], dfn[x] - (k - now) + 1)) % P;
    return res;
  } else {
    res = (1ll * res * p[dfn[x] - dfn[lca] + 1] + ask(dfn[x], dfn[lca])) % P;
    now += dfn[x] - dfn[lca] + 1;
  }
  static int opt[N], bec[N];
  int tmp = y, len = 0;
  if (!ok)
    lca = temp;
  else
    lca = jump(y, dep[y] - dep[lca] - 1);
  while (top[y] != top[lca]) {
    bec[++len] = top[y];
    y = fa[top[y]];
    opt[len] = y;
  }
  y = tmp;
  for (int i = len; i; i--) {
    if (now + dfn[opt[i]] - dfn[lca] + 1 >= k) {
      res = (1ll * res * p[k - now] + ask(dfn[lca], dfn[lca] + (k - now) - 1)) %
            P;
      return res;
    } else {
      res = (1ll * res * p[dfn[opt[i]] - dfn[lca] + 1] +
             ask(dfn[lca], dfn[opt[i]])) %
            P;
      now += dfn[opt[i]] - dfn[lca] + 1;
      lca = bec[i];
    }
  }
  if (now + dfn[y] - dfn[lca] + 1 >= k) {
    res =
        (1ll * res * p[k - now] + ask(dfn[lca], dfn[lca] + (k - now) - 1)) % P;
    return res;
  } else {
    res = (1ll * res * p[dfn[y] - dfn[lca] + 1] + ask(dfn[lca], dfn[y])) % P;
  }
  return res;
}
int main() {
  scanf("%d%s", &n, str + 1);
  for (int i = 1, x, y; i < n; i++) {
    scanf("%d%d", &x, &y);
    e[x].push_back(y), e[y].push_back(x);
  }
  p[0] = 1;
  for (int i = 1; i <= n; i++) p[i] = 1ll * p[i - 1] * 131 % P;
  dfs1(1);
  dfs2(1, 1);
  for (int i = 1; i <= n; i++)
    pre[i] = (1ll * pre[i - 1] * 131 + str[idfn[i]] - 'a') % P;
  for (int i = n; i >= 1; i--)
    suf[i] = (1ll * suf[i + 1] * 131 + str[idfn[i]] - 'a') % P;
  scanf("%d", &m);
  while (m--) {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    int l = 0, r = min(dep[a] + dep[b] - 2 * dep[LCA(a, b)],
                       dep[c] + dep[d] - 2 * dep[LCA(c, d)]) +
                   1;
    int ans;
    while (l <= r) {
      int mid = l + r >> 1;
      int q1 = qry(a, b, mid), q2 = qry(c, d, mid);
      if (q1 == q2)
        l = mid + 1, ans = mid;
      else
        r = mid - 1;
    }
    printf("%d\n", ans);
  }
  return 0;
}
