#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
inline char Get() {
  static char c;
  c = getchar();
  while (!isalpha(c)) c = getchar();
  return c;
}
inline void write(int x) {
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
const int N = 300005;
int To[N << 1], Ne[N << 1], He[N], _;
inline void add(int x, int y) {
  ++_;
  To[_] = y, Ne[_] = He[x], He[x] = _;
  ++_;
  To[_] = x, Ne[_] = He[y], He[y] = _;
}
char a[N], s[N << 1];
int n, fa[N], dpt[N], size[N], son[N], top[N], id[N], tl[N], tr[N], pos[N],
    Time;
inline void dfs1(int x) {
  dpt[x] = dpt[fa[x]] + 1, size[x] = 1;
  for (int y, p = He[x]; p; p = Ne[p])
    if (fa[x] ^ (y = To[p])) {
      fa[y] = x, dfs1(y), size[x] += size[y];
      if (size[y] > size[son[x]]) son[x] = y;
    }
}
inline void dfs2(int x) {
  id[x] = tl[x] = ++Time;
  pos[Time] = x;
  s[Time] = a[x], s[(n << 1 | 1) - Time] = a[x];
  if (son[x]) {
    top[son[x]] = top[x], dfs2(son[x]);
    for (int y, p = He[x]; p; p = Ne[p])
      if (!top[y = To[p]]) top[y] = y, dfs2(y);
  }
  tr[x] = Time;
}
inline int LCA(int x, int y) {
  while (top[x] ^ top[y])
    if (dpt[top[x]] > dpt[top[y]])
      x = fa[top[x]];
    else
      y = fa[top[y]];
  return dpt[x] <= dpt[y] ? x : y;
}
int sa[N << 1], rk[N << 1], h[N << 1], st[20][N << 1], Log[N << 1];
inline int LCP(int x, int y) {
  if (x == y) return (n << 1 | 1) - x;
  x = rk[x], y = rk[y];
  if (x > y) swap(x, y);
  ++x;
  static int t;
  t = Log[y - x + 1];
  return min(st[t][x], st[t][y - (1 << t) + 1]);
}
struct SuffixArray {
  int x[N << 1], y[N << 1], c[N << 1], l, a[N << 1];
  inline void getsa(int n) {
    register int i;
    int j, m;
    l = max('z' - 'a' + 1, n);
    for (i = 1; i <= n; ++i) rk[i] = s[i] - 'a' + 1;
    for (j = 1;; j <<= 1) {
      for (i = 1; i <= n; ++i)
        x[i] = rk[i], y[i] = (i + j <= n) ? rk[i + j] : 0;
      memset(c, 0, (l + 1) << 2);
      for (i = 1; i <= n; ++i) ++c[y[i]];
      for (i = 1; i <= l; ++i) c[i] += c[i - 1];
      for (i = 1; i <= n; ++i) a[c[y[i]]--] = i;
      memset(c, 0, (l + 1) << 2);
      for (i = 1; i <= n; ++i) ++c[x[i]];
      for (i = 1; i <= l; ++i) c[i] += c[i - 1];
      for (i = n; i; --i) sa[c[x[a[i]]]--] = a[i];
      m = 0;
      for (i = 1; i <= n; ++i) {
        rk[sa[i]] =
            (x[sa[i]] != x[sa[i - 1]] || y[sa[i]] != y[sa[i - 1]]) ? ++m : m;
      }
      if (m == n) break;
    }
    int now = 0;
    for (i = 1; i <= n; ++i) {
      if (now) --now;
      while (s[i + now] == s[sa[rk[i] - 1] + now]) ++now;
      h[rk[i]] = st[0][rk[i]] = now;
    }
    for (i = 1; i <= n; ++i) {
      Log[i] = Log[i - 1];
      if ((1 << Log[i] + 1) < i) ++Log[i];
    }
    for (i = 1; i <= Log[n]; ++i)
      for (j = 1; j <= n; ++j)
        if (j + (1 << i) - 1 <= n)
          st[i][j] = min(st[i - 1][j], st[i - 1][j + (1 << i - 1)]);
  }
} SA;
int l1[N], r1[N], n1;
inline void get1(int x, int y) {
  int z = LCA(x, y);
  n1 = 0;
  while (top[x] ^ top[z])
    ++n1, l1[n1] = (n << 1 | 1) - id[x], r1[n1] = (n << 1 | 1) - id[top[x]],
          x = fa[top[x]];
  if (id[z] < id[x])
    ++n1, l1[n1] = (n << 1 | 1) - id[x], r1[n1] = (n << 1 | 1) - (id[z] + 1);
  int l = n1;
  while (top[y] ^ top[z])
    ++n1, l1[n1] = id[top[y]], r1[n1] = id[y], y = fa[top[y]];
  ++n1, l1[n1] = id[z], r1[n1] = id[y];
  reverse(l1 + l + 1, l1 + n1 + 1), reverse(r1 + l + 1, r1 + n1 + 1);
}
int l2[N], r2[N], n2;
inline void get2(int x, int y) {
  int z = LCA(x, y);
  n2 = 0;
  while (top[x] ^ top[z])
    ++n2, l2[n2] = (n << 1 | 1) - id[x], r2[n2] = (n << 1 | 1) - id[top[x]],
          x = fa[top[x]];
  if (id[z] < id[x])
    ++n2, l2[n2] = (n << 1 | 1) - id[x], r2[n2] = (n << 1 | 1) - (id[z] + 1);
  int l = n2;
  while (top[y] ^ top[z])
    ++n2, l2[n2] = id[top[y]], r2[n2] = id[y], y = fa[top[y]];
  ++n2, l2[n2] = id[z], r2[n2] = id[y];
  reverse(l2 + l + 1, l2 + n2 + 1), reverse(r2 + l + 1, r2 + n2 + 1);
}
int ans, now1, now2;
inline int solve() {
  int len, len1, len2;
  ans = 0, now1 = now2 = 1;
  while (now1 <= n1 && now2 <= n2) {
    len1 = r1[now1] - l1[now1] + 1;
    len2 = r2[now2] - l2[now2] + 1;
    len = LCP(l1[now1], l2[now2]);
    if (len > len1) len = len1;
    if (len > len2) len = len2;
    ans += len;
    if (len < len1 && len < len2) break;
    if (len1 == len2) {
      ++now1, ++now2;
      continue;
    }
    if (len1 < len2)
      ++now1, l2[now2] += len;
    else
      ++now2, l1[now1] += len;
  }
  return ans;
}
int main() {
  int i, x, y, q;
  read(n);
  for (i = 1; i <= n; ++i) a[i] = Get();
  for (i = 1; i < n; ++i) read(x), read(y), add(x, y);
  dfs1(1), top[1] = 1, dfs2(1);
  s[0] = s[n << 1 | 1] = '\0', SA.getsa(n << 1);
  read(q);
  int qa, qb, qc, qd;
  while (q--) {
    read(qa), read(qb), read(qc), read(qd);
    get1(qa, qb);
    get2(qc, qd);
    write(solve()), putchar('\n');
  }
  return 0;
}
