#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5, bs = 727, mod = 987654321 - 2;
int zrb(int a, int b) { return (1LL * a * b % mod); }
int jm(int a, int b) {
  int tmp = (a + b) % mod;
  if (tmp < 0) tmp += mod;
  return (tmp);
}
int pw(int a, int b) {
  int rt = 1;
  for (; b; b >>= 1) {
    if (b & 1) rt = zrb(rt, a);
    a = zrb(a, a);
  }
  return (rt);
}
int PS[N << 1], TV[N], INV[N], H[N], ID[N], P[N], HD[N], C[N], SZ[N], POS[N],
    POS2[N], NXT[N], n, nn, q, st, idcnt;
int adj[N << 1], HED[N], NEXT[N << 1], TL[N], adjcnt;
pair<int, int> ab[N], cd[N];
char second[N];
void prDFS(int u, int p) {
  SZ[u] = 1;
  P[u] = p;
  for (int i = HED[u]; ~i; i = NEXT[i])
    if (adj[i] ^ p) {
      H[adj[i]] = H[u] + 1;
      prDFS(adj[i], u);
      SZ[u] += SZ[adj[i]];
    }
}
void DFS(int u, int p, int id) {
  PS[st++] = u;
  ID[u] = id;
  if (!HD[id]) HD[id] = u;
  int arshad = 0;
  for (int i = HED[u]; ~i; i = NEXT[i]) {
    int x = adj[i];
    if (x ^ p && SZ[x] >= SZ[arshad]) arshad = x;
  }
  if (arshad) {
    NXT[u] = arshad;
    DFS(arshad, u, id);
  }
  for (int i = HED[u]; ~i; i = NEXT[i]) {
    int x = adj[i];
    if (x ^ p && x ^ arshad) DFS(x, u, ++idcnt);
  }
}
int get(int l, int r) {
  int rt = PS[r];
  if (r < n && l) rt = jm(rt, -PS[l - 1]);
  if (r >= n && l ^ n) rt = jm(rt, -PS[l - 1]);
  if (l < n)
    rt = zrb(rt, INV[l]);
  else
    rt = zrb(rt, INV[l - n]);
  return (rt);
}
int LCA(int a, int b) {
  while (ID[a] ^ ID[b]) {
    if (H[HD[ID[a]]] > H[HD[ID[b]]])
      a = P[HD[ID[a]]];
    else
      b = P[HD[ID[b]]];
  }
  return (H[a] < H[b] ? a : b);
}
int getbs(int l1, int r1, int l2, int r2) {
  int ln = min(r1 - l1, r2 - l2);
  r1 = l1 + ln;
  r2 = l2 + ln;
  int l, r, mid;
  l = 0, r = ln + 1;
  while (r - l > 2) {
    mid = ((l + r) >> 1);
    if (get(l1, l1 + mid) == get(l2, l2 + mid))
      l = mid;
    else
      r = mid;
  }
  if (!l && get(l1, l1) ^ get(l2, l2)) return (0);
  for (int i = min(ln, l + 1); i >= max(0, l - 1); i--)
    if (get(l1, l1 + i) == get(l2, l2 + i)) return (i + 1);
  return (0);
}
int main() {
  memset(NEXT, -1, sizeof(NEXT));
  memset(HED, -1, sizeof(HED));
  scanf("%d", &n);
  scanf("%s", second);
  nn = n << 1;
  for (int i = 1; i <= n; i++) C[i] = second[i - 1] - 'a';
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    if (HED[a] == -1) {
      HED[a] = TL[a] = adjcnt;
      adj[adjcnt++] = b;
    } else {
      NEXT[TL[a]] = adjcnt;
      TL[a] = adjcnt;
      adj[adjcnt++] = b;
    }
    if (HED[b] == -1) {
      HED[b] = TL[b] = adjcnt;
      adj[adjcnt++] = a;
    } else {
      NEXT[TL[b]] = adjcnt;
      TL[b] = adjcnt;
      adj[adjcnt++] = a;
    }
  }
  INV[0] = TV[0] = 1;
  for (int i = 1; i < N; i++) TV[i] = zrb(TV[i - 1], bs);
  INV[1] = pw(bs, mod - 2);
  for (int i = 2; i < N; i++) INV[i] = zrb(INV[i - 1], INV[1]);
  prDFS(1, 0);
  DFS(1, 0, 0);
  for (int i = n; i < nn; i++) PS[i] = PS[i - n];
  reverse(PS + n, PS + nn);
  for (int i = 0; i < n; i++) POS[PS[i]] = i;
  for (int i = n; i < nn; i++) POS2[PS[i]] = i;
  PS[0] = C[PS[0]];
  for (int i = 1; i < n; i++) PS[i] = jm(PS[i - 1], zrb(TV[i], C[PS[i]]));
  PS[n] = C[PS[n]];
  for (int i = n + 1; i < nn; i++)
    PS[i] = jm(PS[i - 1], zrb(TV[i - n], C[PS[i]]));
  scanf("%d", &q);
  for (int Q = 0; Q < q; Q++) {
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    int lcab = LCA(a, b), lccd = LCA(c, d), abab, cdcd, aab, ccd;
    abab = cdcd = 0;
    while (1) {
      if (ID[a] == ID[lcab]) {
        ab[abab++] = {POS2[a], POS2[lcab]};
        break;
      }
      ab[abab++] = {POS2[a], POS2[HD[ID[a]]]};
      a = P[HD[ID[a]]];
    }
    aab = abab;
    while (1) {
      if (ID[b] == ID[lcab]) {
        if (b == lcab) break;
        ab[abab++] = {POS[NXT[lcab]], POS[b]};
        break;
      }
      ab[abab++] = {POS[HD[ID[b]]], POS[b]};
      b = P[HD[ID[b]]];
    }
    while (1) {
      if (ID[c] == ID[lccd]) {
        cd[cdcd++] = {POS2[c], POS2[lccd]};
        break;
      }
      cd[cdcd++] = {POS2[c], POS2[HD[ID[c]]]};
      c = P[HD[ID[c]]];
    }
    ccd = cdcd;
    while (1) {
      if (ID[d] == ID[lccd]) {
        if (d == lccd) break;
        cd[cdcd++] = {POS[NXT[lccd]], POS[d]};
        break;
      }
      cd[cdcd++] = {POS[HD[ID[d]]], POS[d]};
      d = P[HD[ID[d]]];
    }
    reverse(ab + aab, ab + abab);
    reverse(cd + ccd, cd + cdcd);
    reverse(ab, ab + abab);
    reverse(cd, cd + cdcd);
    abab--;
    cdcd--;
    int rt = 0;
    while (abab ^ -1 && cdcd ^ -1) {
      pair<int, int> &A = ab[abab], &C = cd[cdcd];
      int mn = min(A.second - A.first, C.second - C.first);
      if (get(A.first, A.first + mn) ^ get(C.first, C.first + mn)) {
        rt += getbs(A.first, A.second, C.first, C.second);
        break;
      }
      rt += mn + 1;
      A.first += mn + 1;
      C.first += mn + 1;
      if (A.first > A.second) abab--;
      if (C.first > C.second) cdcd--;
    }
    printf("%d\n", rt);
  }
}
