#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int P1 = 998244353, P2 = 1000000007, N = 300005;
struct Hash {
  ll h1, h2;
} B = {19260817, 101}, h1[N], h2[N];
inline Hash operator+(Hash a, Hash b) {
  return {(a.h1 + b.h1) % P1, (a.h2 + b.h2) % P2};
}
inline Hash operator-(Hash a, Hash b) {
  return {(a.h1 - b.h1 + P1) % P1, (a.h2 - b.h2 + P2) % P2};
}
inline Hash operator*(Hash a, Hash b) {
  return {a.h1 * b.h1 % P1, a.h2 * b.h2 % P2};
}
inline bool operator==(Hash a, Hash b) { return a.h1 == b.h1 && a.h2 == b.h2; }
int n, m;
char s[N];
Hash pw[N];
vector<int> v[N];
template <typename T>
void read(T &num) {
  num = 0;
  int ch = getchar();
  T fl = 1;
  while (!isdigit(ch) && ch != 45) ch = getchar();
  if (ch == 45) fl = -1, ch = getchar();
  while (isdigit(ch)) {
    num = (num << 3) + (num << 1) + (ch - 48);
    ch = getchar();
  }
  num *= fl;
}
template <typename T, typename... Arg>
void read(T &num, Arg &...rest) {
  read(num);
  read(rest...);
}
int sz[N], fa[N], dep[N], hson[N], dfn[N], idx, mp[N], top[N];
void dfs(int pos) {
  sz[pos] = 1;
  dep[pos] = dep[fa[pos]] + 1;
  for (auto &i : v[pos])
    if (i != fa[pos]) {
      fa[i] = pos;
      dfs(i);
      sz[pos] += sz[i];
      if (sz[i] > sz[hson[pos]]) hson[pos] = i;
    }
}
void dfs(int pos, int tp) {
  top[pos] = tp;
  dfn[pos] = ++idx;
  mp[idx] = pos;
  if (hson[pos]) dfs(hson[pos], tp);
  for (auto &i : v[pos])
    if (i != fa[pos] && i != hson[pos]) dfs(i, i);
}
int lca(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    x = fa[top[x]];
  }
  return dep[x] < dep[y] ? x : y;
}
vector<pair<int, int>> get(int x, int y) {
  int z = lca(x, y);
  vector<pair<int, int>> ret, tmp;
  while (dep[top[x]] > dep[z]) ret.push_back({x, top[x]}), x = fa[top[x]];
  ret.push_back({x, z});
  while (dep[top[y]] > dep[z]) tmp.push_back({top[y], y}), y = fa[top[y]];
  if (y != z) tmp.push_back({hson[z], y});
  while (!tmp.empty()) ret.push_back(tmp.back()), tmp.pop_back();
  return ret;
}
inline Hash geth(bool up, int pos, int len) {
  if (up) return h2[pos - len + 1] - h2[pos + 1] * pw[len];
  return h1[pos + len - 1] - h1[pos - 1] * pw[len];
}
int main() {
  ios::sync_with_stdio(false);
  read(n);
  scanf("%s", s + 1);
  pw[0] = {1, 1};
  pw[1] = B;
  for (int i = 2; i <= n; i++) pw[i] = pw[i - 1] * B;
  int t1, t2;
  for (int i = 1; i < n; i++) {
    read(t1, t2);
    v[t1].push_back(t2);
    v[t2].push_back(t1);
  }
  dfs(1);
  dfs(1, 1);
  for (int i = 1; i <= n; i++) h1[i] = h1[i - 1] * B + Hash{s[mp[i]], s[mp[i]]};
  for (int i = n; i > 0; --i) h2[i] = h2[i + 1] * B + Hash{s[mp[i]], s[mp[i]]};
  read(m);
  while (m--) {
    int a, b, c, d, ans = 0, p1 = 0, p2 = 0;
    read(a, b, c, d);
    auto aa = get(a, b), bb = get(c, d);
    while (p1 < int(aa.size()) && p2 < int(bb.size())) {
      int ida1 = dfn[aa[p1].first], ida2 = dfn[aa[p1].second];
      int idb1 = dfn[bb[p2].first], idb2 = dfn[bb[p2].second];
      bool oa = ida1 > ida2, ob = idb1 > idb2;
      int la = abs(ida1 - ida2) + 1, lb = abs(idb1 - idb2) + 1,
          len = min(la, lb);
      Hash ha = geth(oa, ida1, len), hb = geth(ob, idb1, len);
      if (ha == hb) {
        ans += len;
        if (len == la)
          ++p1;
        else
          aa[p1].first = mp[ida1 + (oa ? -1 : 1) * len];
        if (len == lb)
          ++p2;
        else
          bb[p2].first = mp[idb1 + (ob ? -1 : 1) * len];
      } else {
        int l = 1, r = len, tmp = 0;
        while (l <= r) {
          int mid = (l + r) >> 1;
          Hash ha = geth(oa, ida1, mid), hb = geth(ob, idb1, mid);
          if (ha == hb)
            tmp = mid, l = mid + 1;
          else
            r = mid - 1;
        }
        ans += tmp;
        break;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
