#include <bits/stdc++.h>
using namespace std;
const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;
template <typename T>
inline void read(T &x) {
  char ch, t = 0;
  x = 0;
  while (!isdigit(ch = (iS == iT
                            ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                               (iS == iT ? EOF : *iS++))
                            : *iS++)))
    t |= ch == '-';
  while (isdigit(ch))
    x = x * 10 + (ch ^ 48),
    ch = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                      (iS == iT ? EOF : *iS++))
                   : *iS++);
  x = t ? -x : x;
}
inline int read_int() {
  int x;
  return read(x), x;
}
inline long long read_ll() {
  long long x;
  return read(x), x;
}
template <typename T>
inline void chkmin(T &a, T b) {
  a = a < b ? a : b;
}
template <typename T>
inline void chkmax(T &a, T b) {
  a = a > b ? a : b;
}
const int mod = 104857601;
const int MAXN = 300010;
inline char get_alpha() {
  char c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                        (iS == iT ? EOF : *iS++))
                     : *iS++);
  while (!isalpha(c))
    c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin),
                     (iS == iT ? EOF : *iS++))
                  : *iS++);
  return c;
}
int n;
vector<int> to[MAXN];
int up[MAXN];
int dn[MAXN];
int pw[MAXN * 2];
char s[MAXN];
int d[MAXN];
int Fa[MAXN][32][4];
int fa[MAXN][20];
int Log[MAXN];
inline void dfs(int x, int la) {
  up[x] = (37LL * up[la] + s[x]) % mod;
  dn[x] = (dn[la] + 1LL * s[x] * pw[d[la] + 1]) % mod;
  fa[x][0] = la, d[x] = d[la] + 1;
  for (int i = 1; i < 20; i++) fa[x][i] = fa[fa[x][i - 1]][i - 1];
  int La = la;
  for (int i = 0; i < 4; i++) {
    Fa[x][0][i] = x;
    Fa[x][1][i] = La;
    for (int j = 2; j < 32; j++) Fa[x][j][i] = La = Fa[La][1][i];
    La = Fa[La][1][i];
  }
  for (auto u : to[x]) {
    if (u == la) continue;
    dfs(u, x);
  }
}
inline int UP(int x, int k) {
  int t = 0;
  while (k) x = Fa[x][k & 31][t++], k >>= 5;
  return x;
}
inline int LCA(int x, int y) {
  if (d[x] < d[y]) swap(x, y);
  x = UP(x, d[x] - d[y]);
  if (x == y) return x;
  for (int i = 19; ~i; --i)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
inline int calc(int u, int v, int a, int l) {
  if (d[u] - d[a] + 1 >= l) {
    int x = UP(u, l);
    return (1LL * up[u] * pw[n] + 1LL * (mod - up[x]) * pw[n + d[u] - d[x]]) %
           mod;
  } else {
    int x = UP(v, d[u] + d[v] - d[a] * 2 - l + 1);
    long long L = 1LL * up[u] * pw[n] +
                  1LL * (mod - up[fa[a][0]]) * pw[n + d[u] - d[a] + 1];
    long long R = 1LL * (dn[x] - dn[a] + mod) * pw[n + d[u] - d[a] * 2];
    return (L + R) % mod;
  }
}
int main() {
  n = read_int(), pw[0] = 1;
  for (int i = 1; i <= n * 2; i++) pw[i] = 37LL * pw[i - 1] % mod;
  for (int i = 2; i <= n; i++) Log[i] = Log[i >> 1] + 1;
  for (int i = 1; i <= n; i++) s[i] = get_alpha() - 'a';
  for (int i = 1; i < n; i++) {
    int u = read_int(), v = read_int();
    to[u].push_back(v);
    to[v].push_back(u);
  }
  d[0] = -1, dfs(1, 0);
  int q = read_int();
  while (q--) {
    int a = read_int(), b = read_int(), x = read_int(), y = read_int();
    int l1 = LCA(a, b), l2 = LCA(x, y);
    int L1 = d[a] + d[b] - d[l1] * 2 + 1;
    int L2 = d[x] + d[y] - d[l2] * 2 + 1;
    int l = 1, r = min(L1, L2);
    while (l <= r) {
      int mid = (l + r) >> 1;
      int Hash1 = calc(a, b, l1, mid);
      int Hash2 = calc(x, y, l2, mid);
      if (Hash1 == Hash2)
        l = mid + 1;
      else
        r = mid - 1;
    }
    printf("%d\n", l - 1);
  }
  return 0;
}
