#include <bits/stdc++.h>
using namespace std;
const int N = 6e5 + 5;
int n, m, fa[N], dep[N], sz[N], top[N], dfn[N], tim;
vector<int> E[N];
char tmp[N], str[N];
void dfs1(int u, int f) {
  fa[u] = f;
  dep[u] = dep[f] + 1;
  sz[u] = 1;
  for (int v : E[u])
    if (v != f) dfs1(v, u), sz[u] += sz[v];
}
void dfs2(int u, int f) {
  top[u] = f;
  str[dfn[u] = ++tim] = tmp[u];
  int son = 0;
  for (int v : E[u])
    if (v != fa[u] && sz[v] > sz[son]) son = v;
  if (son) dfs2(son, f);
  for (int v : E[u])
    if (v != fa[u] && v != son) dfs2(v, v);
}
int t[N], x[N], y[N], sa[N], rk[N], lg[N], st[20][N];
bool cmp(int i, int j, int k) { return y[i] == y[j] && y[i + k] == y[j + k]; }
void build() {
  int m = 30;
  for (int i = 1; i <= n; ++i) ++t[x[i] = str[i] - 'a' + 1];
  for (int i = 1; i <= m; ++i) t[i] += t[i - 1];
  for (int i = n; i; --i) sa[t[x[i]]--] = i;
  for (int k = 1; k <= n; k <<= 1) {
    int p = 0;
    for (int i = 0; i <= m; ++i) y[i] = 0;
    for (int i = n - k + 1; i <= n; ++i) y[++p] = i;
    for (int i = 1; i <= n; ++i)
      if (sa[i] > k) y[++p] = sa[i] - k;
    for (int i = 0; i <= m; ++i) t[i] = 0;
    for (int i = 1; i <= n; ++i) ++t[x[y[i]]];
    for (int i = 1; i <= m; ++i) t[i] += t[i - 1];
    for (int i = n; i; --i) sa[t[x[y[i]]]--] = y[i];
    swap(x, y);
    x[sa[1]] = p = 1;
    for (int i = 2; i <= n; ++i) x[sa[i]] = cmp(sa[i], sa[i - 1], k) ? p : ++p;
    if (p >= n) break;
    m = p;
  }
  for (int i = 1; i <= n; ++i) rk[sa[i]] = i;
  for (int i = 2; i <= n; ++i) lg[i] = lg[i >> 1] + 1;
  for (int i = 1, j = 0; i <= n; ++i) {
    if (j) --j;
    while (str[i + j] == str[sa[rk[i] - 1] + j]) ++j;
    st[0][rk[i]] = j;
  }
  for (int i = 1; i <= lg[n]; ++i)
    for (int j = 1; j + (1 << i) - 1 <= n; ++j)
      st[i][j] = min(st[i - 1][j], st[i - 1][j + (1 << i - 1)]);
}
int lcp(int i, int j) {
  if (i == j) return n - i + 1;
  i = rk[i];
  j = rk[j];
  if (i > j) swap(i, j);
  ++i;
  int k = lg[j - i + 1];
  return min(st[k][i], st[k][j - (1 << k) + 1]);
}
vector<pair<int, int> > get(int x, int y) {
  vector<pair<int, int> > foo, bar;
  while (top[x] != top[y])
    if (dep[top[x]] > dep[top[y]])
      foo.push_back({n + 1 - dfn[x], dfn[x] - dfn[top[x]] + 1}), x = fa[top[x]];
    else
      bar.push_back({dfn[top[y]], dfn[y] - dfn[top[y]] + 1}), y = fa[top[y]];
  if (dep[x] > dep[y])
    foo.push_back({n + 1 - dfn[x], dfn[x] - dfn[y] + 1});
  else
    bar.push_back({dfn[x], dfn[y] - dfn[x] + 1});
  while (bar.size()) foo.push_back(bar.back()), bar.pop_back();
  return foo;
}
int main() {
  scanf("%d%s", &n, tmp + 1);
  for (int i = 1, x, y; i < n; ++i) {
    scanf("%d%d", &x, &y);
    E[x].push_back(y);
    E[y].push_back(x);
  }
  dfs1(1, 0);
  dfs2(1, 1);
  for (int i = 1; i <= n; ++i) str[n + i] = str[n + 1 - i];
  n <<= 1;
  build();
  scanf("%d", &m);
  for (int i = 1, a, b, c, d; i <= m; ++i) {
    scanf("%d%d%d%d", &a, &b, &c, &d);
    vector<pair<int, int> > foo = get(a, b), bar = get(c, d);
    int ans = 0;
    for (int i = 0, j = 0; i < foo.size() && j < bar.size();) {
      int k = min(lcp(foo[i].first, bar[j].first),
                  min(foo[i].second, bar[j].second));
      ans += k;
      if (k < min(foo[i].second, bar[j].second)) break;
      if (k == foo[i].second)
        ++i;
      else
        foo[i].first += k, foo[i].second -= k;
      if (k == bar[j].second)
        ++j;
      else
        bar[j].first += k, bar[j].second -= k;
    }
    printf("%d\n", ans);
  }
  return 0;
}
