#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char ch = getchar();
  int res = 0, w = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    res = res * 10 + ch - '0';
    ch = getchar();
  }
  return res * w;
}
const int N = 3e5 + 5, mod1 = 1e9 + 7, mod2 = 1004535809, base1 = 233,
          base2 = 403;
int n, m, sum, a[N], pow1[N], pow2[N], inv1[N], inv2[N], hsh1[N], hsh2[N],
    hsh1_[N], hsh2_[N], d[N], dfn[N], son[N], len[N], md[N], lg[N << 1],
    f[20][N], st[20][N << 1];
vector<int> e[N], down[N], up[N];
char s[N];
struct hsh {
  long long val1, val2, len;
  hsh operator+(const hsh& x) const {
    return (hsh){((long long)val1 * pow1[x.len] + x.val1) % mod1,
                 ((long long)val2 * pow2[x.len] + x.val2) % mod2, len + x.len};
  }
};
inline int Min(int x, int y) { return x < y ? x : y; }
inline int qmod(long long x, int mod) {
  if (x < 0) return x + mod;
  if (x >= mod * 2) return x % mod;
  if (x >= mod) return x - mod;
  return x;
}
inline int qpow(int x, int y, int mod) {
  int res = 1;
  while (y) {
    if (y & 1) res = qmod((long long)res * x, mod);
    x = qmod((long long)x * x, mod);
    y >>= 1;
  }
  return res;
}
void dfs1(int x) {
  d[x] = d[f[0][x]] + 1;
  hsh1[x] = qmod(qmod((long long)base1 * hsh1[f[0][x]], mod1) + s[x], mod1);
  hsh2[x] = qmod(qmod((long long)base2 * hsh2[f[0][x]], mod2) + s[x], mod2);
  hsh1_[x] =
      qmod(qmod((long long)pow1[d[x]] * s[x], mod1) + hsh1_[f[0][x]], mod1);
  hsh2_[x] =
      qmod(qmod((long long)pow2[d[x]] * s[x], mod2) + hsh2_[f[0][x]], mod2);
  dfn[x] = ++sum;
  st[0][sum] = x;
  len[x] = d[x];
  for (register int i = 1; (1 << i) < d[x]; i++)
    f[i][x] = f[i - 1][f[i - 1][x]];
  for (register int i = 0; i < e[x].size(); i++)
    if (e[x][i] != f[0][x]) {
      f[0][e[x][i]] = x;
      dfs1(e[x][i]);
      st[0][++sum] = x;
      if (len[e[x][i]] > len[son[x]]) {
        son[x] = e[x][i];
        len[x] = len[e[x][i]];
      }
    }
}
inline int lca(int x, int y) {
  int u = dfn[x], v = dfn[y];
  if (u > v) {
    int t = u;
    u = v;
    v = t;
  }
  return d[st[lg[v - u + 1]][u]] <
                 d[st[lg[v - u + 1]][v - (1 << lg[v - u + 1]) + 1]]
             ? st[lg[v - u + 1]][u]
             : st[lg[v - u + 1]][v - (1 << lg[v - u + 1]) + 1];
}
void dfs2(int x, int top) {
  md[x] = top;
  if (son[x]) dfs2(son[x], top);
  for (register int i = 0; i < e[x].size(); i++)
    if (e[x][i] != f[0][x] && e[x][i] != son[x]) dfs2(e[x][i], e[x][i]);
}
inline int kfa(int x, int k) {
  if (!k) return x;
  if (k >= d[x] || k < 0) return 0;
  x = f[lg[k]][x];
  if (!x) return 0;
  k -= (1 << lg[k]);
  return d[x] - d[md[x]] >= k ? down[md[x]][d[x] - d[md[x]] - k]
                              : up[md[x]][k - d[x] + d[md[x]]];
}
inline hsh get(int u, int v) {
  return (hsh){
      qmod(hsh1[v] - qmod((long long)hsh1[u] * pow1[d[v] - d[u]], mod1), mod1),
      qmod(hsh2[v] - qmod((long long)hsh2[u] * pow2[d[v] - d[u]], mod2), mod2),
      d[v] - d[u]};
}
inline hsh get_(int u, int v) {
  return (hsh){
      qmod((long long)qmod(hsh1_[v] - hsh1_[u], mod1) * inv1[d[u] + 1], mod1),
      qmod((long long)qmod(hsh2_[v] - hsh2_[u], mod2) * inv2[d[u] + 1], mod2),
      d[v] - d[u]};
}
signed main() {
  n = read();
  scanf("%s", s + 1);
  pow1[0] = pow2[0] = 1;
  for (register int i = 1; i <= n; i++) {
    pow1[i] = qmod((long long)pow1[i - 1] * base1, mod1);
    pow2[i] = qmod((long long)pow2[i - 1] * base2, mod2);
    inv1[i] = qpow(pow1[i], mod1 - 2, mod1);
    inv2[i] = qpow(pow2[i], mod2 - 2, mod2);
  }
  for (register int i = 1; i < n; i++) {
    int u = read(), v = read();
    e[u].push_back(v);
    e[v].push_back(u);
  }
  dfs1(1);
  dfs2(1, 1);
  for (register int i = 2; i <= sum; i++) lg[i] = lg[i >> 1] + 1;
  for (register int i = 1; i < 20; i++)
    for (register int j = 1; j + (1 << i) - 1 <= sum; j++)
      st[i][j] = d[st[i - 1][j]] < d[st[i - 1][j + (1 << i - 1)]]
                     ? st[i - 1][j]
                     : st[i - 1][j + (1 << i - 1)];
  for (register int i = 1; i <= n; i++)
    if (md[i] == i)
      for (register int j = 0, fa = i, af = i; j <= len[i] - d[i];
           j++, fa = f[0][fa], af = son[af]) {
        up[i].push_back(fa);
        down[i].push_back(af);
      }
  m = read();
  while (m--) {
    if (m == 999964) {
      int jb = 0;
    }
    int qwq = read(), QWQ = read(), qaq = read(), QAQ = read(),
        l1 = lca(qwq, QWQ), l2 = lca(qaq, QAQ),
        d1 = d[qwq] + d[QWQ] - 2 * d[l1], d2 = d[qaq] + d[QAQ] - 2 * d[l2],
        l = 0, r = Min(d1, d2), ans = 0;
    while (l <= r) {
      int mid = (l + r) >> 1;
      hsh x = (d[qwq] - mid >= d[l1])
                  ? get_(kfa(qwq, mid + 1), qwq)
                  : (get_(f[0][l1], qwq) + get(l1, kfa(QWQ, d1 - mid))),
          y = (d[qaq] - mid >= d[l2])
                  ? get_(kfa(qaq, mid + 1), qaq)
                  : (get_(f[0][l2], qaq) + get(l2, kfa(QAQ, d2 - mid)));
      if (x.len == y.len && x.val1 == y.val1 && x.val2 == y.val2) {
        l = ans = mid + 1;
      } else
        r = mid - 1;
    }
    printf("%d\n", ans);
  }
  return 0;
}
