#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int res = 0;
  char c;
  bool zf = 0;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-')
    zf = 1;
  else
    res = c - '0';
  while ((c = getchar()) >= '0' && c <= '9')
    res = (res << 3) + (res << 1) + c - '0';
  if (zf) return -res;
  return res;
}
int dta[300005];
vector<int> G[300005];
int power1[300005], power2[300005];
int inv1[300005], inv2[300005];
int Hash1[300005][2], Hash2[300005][2];
vector<int> _up[300005], _down[300005];
int dep[300005], maxdep[300005], fa[300005], size[300005], son1[300005],
    son2[300005], top1[300005], top2[300005];
int ffa[300005][25];
int highbit[300005];
inline int ksm(int x, int y, int mod) {
  int res = 1;
  while (y) {
    if (y & 1) {
      res = 1ll * res * x % mod;
    }
    x = 1ll * x * x % mod;
    y >>= 1;
  }
  return res;
}
void dfs1(int x) {
  size[x] = 1;
  for (register int i = 0; i < G[x].size(); ++i) {
    int v = G[x][i];
    if (dep[v]) {
      continue;
    }
    dep[v] = dep[x] + 1;
    maxdep[v] = 1;
    fa[v] = x;
    dfs1(v);
    size[x] += size[v];
    maxdep[x] = max(maxdep[x], maxdep[v] + 1);
    if (size[v] > size[son1[x]]) {
      son1[x] = v;
    }
    if (maxdep[v] > maxdep[son2[x]]) {
      son2[x] = v;
    }
  }
  return;
}
void dfs2(int x) {
  if (!son1[x]) {
    return;
  }
  if (son1[x] == son2[x]) {
    top1[son1[x]] = top1[x];
    top2[son2[x]] = top2[x];
    dfs2(son1[x]);
  } else {
    top1[son1[x]] = top1[x];
    dfs2(top2[son1[x]] = son1[x]);
    top2[son2[x]] = top2[x];
    dfs2(top1[son2[x]] = son2[x]);
  }
  for (register int i = 0; i < G[x].size(); ++i) {
    int v = G[x][i];
    if (v == fa[x] || v == son1[x] || v == son2[x]) {
      continue;
    }
    dfs2(top1[v] = top2[v] = v);
  }
  return;
}
inline int LCA(int x, int y) {
  while (top1[x] != top1[y]) {
    if (dep[top1[x]] < dep[top1[y]]) {
      swap(x, y);
    }
    x = fa[top1[x]];
  }
  if (dep[x] > dep[y]) {
    swap(x, y);
  }
  return x;
}
void getfa(int x) {
  ffa[x][0] = fa[x];
  for (register int i = 1; i <= 19; ++i) {
    ffa[x][i] = ffa[ffa[x][i - 1]][i - 1];
  }
  for (register int i = 0; i < G[x].size(); ++i) {
    int v = G[x][i];
    if (v == fa[x]) {
      continue;
    }
    getfa(v);
  }
  return;
}
inline void up_and_down(int n) {
  for (register int i = 1; i <= n; ++i) {
    if (top2[i] == i) {
      int now = i;
      while (now) {
        _down[i].push_back(now);
        now = son2[now];
      }
      now = i;
      while (now && _up[i].size() + 1 <= _down[i].size()) {
        _up[i].push_back(now);
        now = fa[now];
      }
    }
  }
  return;
}
inline int kthfa(int x, int k) {
  if (dep[x] <= k) {
    return 0;
  }
  if (!k) {
    return x;
  }
  int tmp = highbit[k];
  x = ffa[x][tmp];
  k -= (1 << tmp);
  if (!k) {
    return x;
  }
  int cz = dep[x] - dep[top2[x]];
  if (cz >= k) {
    return _down[top2[x]][cz - k];
  }
  return _up[top2[x]][k - cz];
}
inline int dist(int x, int y) {
  int l = LCA(x, y);
  return dep[x] + dep[y] - 2 * dep[l] + 1;
}
void get_Hash(int now) {
  Hash1[now][0] =
      (1ll * Hash1[fa[now]][0] * 19260817 % 1000000007 + dta[now]) % 1000000007;
  Hash1[now][1] =
      (Hash1[fa[now]][1] + 1ll * dta[now] * power1[dep[now] - 1] % 1000000007) %
      1000000007;
  Hash2[now][0] =
      (1ll * Hash2[fa[now]][0] * 19491001 % 1000000009 + dta[now]) % 1000000009;
  Hash2[now][1] =
      (Hash2[fa[now]][1] + 1ll * dta[now] * power2[dep[now] - 1] % 1000000009) %
      1000000009;
  for (register int i = 0; i < G[now].size(); ++i) {
    int v = G[now][i];
    if (v == fa[now]) {
      continue;
    }
    get_Hash(v);
  }
  return;
}
inline int _get(int x, int y, int opt) {
  if (dep[x] > dep[y]) {
    if (opt == 1) {
      return 1ll * ((Hash1[x][1] - Hash1[fa[y]][1] + 1000000007) % 1000000007) *
             inv1[dep[y] - 1] % 1000000007;
    }
    return 1ll * ((Hash2[x][1] - Hash2[fa[y]][1] + 1000000009) % 1000000009) *
           inv2[dep[y] - 1] % 1000000009;
  }
  if (opt == 1) {
    return (Hash1[y][0] -
            (1ll * Hash1[fa[x]][0] * power1[dep[y] - dep[x] + 1] % 1000000007) +
            1000000007) %
           1000000007;
  }
  return (Hash2[y][0] -
          (1ll * Hash2[fa[x]][0] * power2[dep[y] - dep[x] + 1] % 1000000009) +
          1000000009) %
         1000000009;
}
signed main() {
  int n = read();
  for (register int i = 0; (1 << i) <= n; ++i) {
    highbit[1 << i] = i;
  }
  for (register int i = 2; i <= n; ++i)
    if (!highbit[i]) {
      highbit[i] = highbit[i - 1];
    }
  string s;
  cin >> s;
  for (register int i = 1; i <= n; ++i) {
    dta[i] = s[i - 1] - 'a';
  }
  for (register int i = 1; i < n; ++i) {
    int x = read(), y = read();
    G[x].push_back(y), G[y].push_back(x);
  }
  power1[0] = power2[0] = 1;
  for (register int i = 1; i <= n; ++i) {
    power1[i] = 1ll * power1[i - 1] * 19260817 % 1000000007;
    power2[i] = 1ll * power2[i - 1] * 19491001 % 1000000009;
  }
  int _inv1 = ksm(19260817, 1000000007 - 2, 1000000007),
      _inv2 = ksm(19491001, 1000000009 - 2, 1000000009);
  inv1[0] = inv2[0] = 1;
  for (register int i = 1; i <= n; ++i) {
    inv1[i] = 1ll * inv1[i - 1] * _inv1 % 1000000007;
    inv2[i] = 1ll * inv2[i - 1] * _inv2 % 1000000009;
  }
  dfs1(dep[1] = maxdep[1] = 1);
  dfs2(top1[1] = top2[1] = 1);
  getfa(1);
  up_and_down(n);
  get_Hash(1);
  int m = read();
  while (m--) {
    int a = read(), b = read(), c = read(), d = read();
    int d1 = dist(a, b), d2 = dist(c, d), lca1 = LCA(a, b), lca2 = LCA(c, d),
        l = 1, r = min(d1, d2), ans = 0;
    while (l <= r) {
      int mid = (l + r) >> 1;
      int _hash1 =
              ((dep[a] - dep[lca1] + 1 >= mid)
                   ? _get(a, kthfa(a, mid - 1), 1)
                   : (((1ll * _get(a, lca1, 1) *
                        power1[mid - (dep[a] - dep[lca1] + 1)] % 1000000007) +
                       (_get(lca1, kthfa(b, d1 - mid), 1) -
                        1ll * dta[lca1] *
                            power1[mid - (dep[a] - dep[lca1] + 1)] %
                            1000000007 +
                        1000000007) %
                           1000000007) %
                      1000000007)),
          _hash2 =
              ((dep[c] - dep[lca2] + 1 >= mid)
                   ? _get(c, kthfa(c, mid - 1), 1)
                   : (((1ll * _get(c, lca2, 1) *
                        power1[mid - (dep[c] - dep[lca2] + 1)] % 1000000007) +
                       (_get(lca2, kthfa(d, d2 - mid), 1) -
                        1ll * dta[lca2] *
                            power1[mid - (dep[c] - dep[lca2] + 1)] %
                            1000000007 +
                        1000000007) %
                           1000000007) %
                      1000000007));
      if (_hash1 != _hash2) {
        r = mid - 1;
        continue;
      }
      _hash1 =
          ((dep[a] - dep[lca1] + 1 >= mid)
               ? _get(a, kthfa(a, mid - 1), 2)
               : (((1ll * _get(a, lca1, 2) *
                    power2[mid - (dep[a] - dep[lca1] + 1)] % 1000000009) +
                   (_get(lca1, kthfa(b, d1 - mid), 2) -
                    1ll * dta[lca1] * power2[mid - (dep[a] - dep[lca1] + 1)] %
                        1000000009 +
                    1000000009) %
                       1000000009) %
                  1000000009)),
      _hash2 =
          ((dep[c] - dep[lca2] + 1 >= mid)
               ? _get(c, kthfa(c, mid - 1), 2)
               : (((1ll * _get(c, lca2, 2) *
                    power2[mid - (dep[c] - dep[lca2] + 1)] % 1000000009) +
                   (_get(lca2, kthfa(d, d2 - mid), 2) -
                    1ll * dta[lca2] * power2[mid - (dep[c] - dep[lca2] + 1)] %
                        1000000009 +
                    1000000009) %
                       1000000009) %
                  1000000009));
      if (_hash1 != _hash2) {
        r = mid - 1;
        continue;
      }
      ans = mid;
      l = mid + 1;
    }
    printf("%d\n", ans);
  }
  return 0;
}
