#include <bits/stdc++.h>
using namespace std;
const int Maxx = 1000001, Maxn = 2001, INF = 0x3f3f3f3f, Mod = 998244353;
inline int read() {
  int res = 0, bj = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') bj |= (ch == '-'), ch = getchar();
  while (ch >= '0' && ch <= '9')
    res = (res << 3) + (res << 1) + (ch ^ 48), ch = getchar();
  return bj ? -res : res;
}
void print(int x) {
  if (x > 9) print(x / 10);
  putchar(x % 10 ^ 48);
}
inline void printnum(int x, char ch) {
  if (x < 0) putchar('-'), x = -x;
  print(x), putchar(ch);
}
int n, h[Maxx], to[Maxx << 1], nx[Maxx << 1], lg[Maxx], prt[Maxx], f[Maxx][19];
int tot, d[Maxx], md[Maxx], sn[Maxx], tp[Maxx], td[Maxx], P[Maxx << 1];
const long long bs = 29;
long long hx[Maxx], hp[Maxx], mi[Maxx];
char S[Maxx];
inline void ckmax(int &x, const int y) { x = x > y ? x : y; }
inline int Min(const int x, const int y) { return x < y ? x : y; }
void Dfs1(int x, int fa) {
  md[x] = d[x] = d[prt[x] = f[x][0] = fa] + 1;
  hx[x] = (hx[fa] * bs + S[x] - 'a' + 1) % Mod;
  hp[x] = (hp[fa] + (S[x] - 'a' + 1) * mi[d[x] - 1]) % Mod;
  for (int i = 1; f[x][i - 1]; ++i) f[x][i] = f[f[x][i - 1]][i - 1];
  for (int i = h[x], y; i; i = nx[i])
    if ((y = to[i]) ^ fa) {
      Dfs1(y, x), ckmax(md[x], md[y]);
      if (md[sn[x]] < md[y]) sn[x] = y;
    }
}
void Dfs2(int x, int bo) {
  if (sn[x]) {
    for (int i = h[x], y; i; i = nx[i])
      if ((y = to[i]) ^ prt[x] && y ^ sn[x]) Dfs2(y, y);
    Dfs2(sn[x], bo);
  }
  if ((P[td[x] = ++tot] = x) == (tp[x] = bo)) {
    for (int i = md[x] - d[x]; i; --i) P[++tot] = x = prt[x];
  }
}
inline int FindK_fa(int x, int k) {
  if (!k) return x;
  x = f[x][lg[k]], k -= 1 << lg[k];
  return P[td[tp[x]] + k - d[x] + d[tp[x]]];
}
inline int lca(int x, int y) {
  if (d[x] < d[y]) x ^= y ^= x ^= y;
  for (int i = lg[d[x] - d[y]]; ~i; --i)
    if (d[f[x][i]] >= d[y]) x = f[x][i];
  if (x == y) return x;
  for (int i = lg[d[x]]; ~i; --i)
    if (f[x][i] ^ f[y][i]) x = f[x][i], y = f[y][i];
  return f[x][0];
}
struct node {
  long long v;
  int ln;
  inline node(long long a = 0, int b = 0) { v = a, ln = b; }
  inline bool operator==(const node &tp) {
    if (ln < tp.ln)
      return v * mi[tp.ln - ln] % Mod == tp.v;
    else
      return v == tp.v * mi[ln - tp.ln] % Mod;
  }
};
inline node Ask(int x, int y, int l, int ln) {
  static int p;
  static long long rx, ry;
  if ((p = d[x] - d[l] + 1) >= ln)
    return node((hx[x] - hx[FindK_fa(x, ln)] * mi[ln] % Mod + Mod) % Mod, ln);
  else {
    rx = (hx[x] - hx[prt[l]] * mi[p] % Mod + Mod) % Mod, ln -= p;
    ry = (hp[FindK_fa(y, d[y] - d[l] - ln)] - hp[l] + Mod) % Mod;
    if (d[l] >= p)
      rx = (rx * mi[d[l] - p] + ry) % Mod, ln += d[l];
    else
      rx = (rx + ry * mi[p - d[l]]) % Mod, ln += p;
    return node(rx, ln);
  }
}
int main() {
  n = read(), scanf("%s", S + 1), lg[0] = -1;
  for (int i = 1; i <= n; ++i) lg[i] = lg[i >> 1] + 1;
  for (int i = mi[0] = 1; i <= n; ++i) mi[i] = mi[i - 1] * bs % Mod;
  for (int i = 1, x, y; i < n; ++i) {
    nx[i << 1] = h[x = read()], to[h[x] = i << 1] = y = read();
    nx[i << 1 | 1] = h[y], to[h[y] = i << 1 | 1] = x;
  }
  Dfs1(1, 0), Dfs2(1, 1), n = read() + 1;
  int A, B, C, D, AB, CD, l, r, mid;
  while (--n) {
    A = read(), B = read(), C = read(), D = read();
    if (S[A] != S[C]) {
      puts("0");
      continue;
    }
    AB = lca(A, B), CD = lca(C, D);
    l = 1, r = Min(d[A] + d[B] - (d[AB] << 1), d[C] + d[D] - (d[CD] << 1)) + 1;
    while (l < r) {
      mid = l + r + 1 >> 1;
      if (Ask(A, B, AB, mid) == Ask(C, D, CD, mid))
        l = mid;
      else
        r = mid - 1;
    }
    printnum(l, '\n');
  }
  return 0;
}
