#include <bits/stdc++.h>
using namespace std;
const int N = 6e5 + 10;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
int n, m, fa[N], son[N], siz[N], dep[N], top[N], dfn[N], tim = 0, ht[N], rnk[N],
                                                         lg2[N], st[20][N];
char s[N], tmp[N];
vector<int> E[N];
bool cmp(int *r, int a, int b, int l) {
  return r[a] == r[b] && r[a + l] == r[b + l];
}
int query(int l, int r) {
  int k = lg2[r - l + 1];
  return min(st[k][l], st[k][r - (1 << k) + 1]);
}
int lcp(int x, int y) {
  if (x == y) return n - x + 1;
  if (rnk[x] > rnk[y]) swap(x, y);
  return query(rnk[x] + 1, rnk[y]);
}
void build() {
  static int ws[N], wv[N], x[N], y[N], sa[N];
  int m = 128;
  for (int i = 0; i <= m; i++) ws[i] = 0;
  for (int i = 1; i <= n; i++) ws[x[i] = s[i]]++;
  for (int i = 1; i <= m; i++) ws[i] += ws[i - 1];
  for (int i = n; i; i--) sa[ws[x[i]]--] = i;
  for (int j = 1;; j <<= 1) {
    int p = 0;
    for (int i = n - j + 1; i <= n; i++) y[++p] = i;
    for (int i = 1; i <= n; i++)
      if (sa[i] > j) y[++p] = sa[i] - j;
    for (int i = 1; i <= n; i++) wv[i] = x[y[i]];
    for (int i = 0; i <= m; i++) ws[i] = 0;
    for (int i = 1; i <= n; i++) ws[wv[i]]++;
    for (int i = 1; i <= m; i++) ws[i] += ws[i - 1];
    for (int i = n; i; i--) sa[ws[wv[i]]--] = y[i];
    swap(x, y);
    x[sa[1]] = p = 1;
    for (int i = 2; i <= n; i++)
      x[sa[i]] = cmp(y, sa[i - 1], sa[i], j) ? p : ++p;
    if (p == n) break;
    m = p;
  }
  for (int i = 1; i <= n; i++) rnk[sa[i]] = i;
  for (int i = 1, j, k = 0; i <= n; ht[rnk[i++]] = k)
    for (k ? k-- : 0, j = sa[rnk[i] - 1]; s[i + k] == s[j + k]; k++)
      ;
  for (int i = 2; i <= n; i++) lg2[i] = lg2[i >> 1] + 1;
  for (int i = 1; i <= n; i++) st[0][i] = ht[i];
  for (int j = 1; (1 << j) <= n; j++)
    for (int i = 1; i + (1 << j) - 1 <= n; i++)
      st[j][i] = min(st[j - 1][i], st[j - 1][i + (1 << (j - 1))]);
}
void dfs1(int u, int ff) {
  fa[u] = ff, siz[u] = 1, dep[u] = dep[ff] + 1;
  for (auto v : E[u])
    if (v ^ ff) {
      dfs1(v, u), siz[u] += siz[v];
      if (siz[son[u]] < siz[v]) son[u] = v;
    }
}
void dfs2(int u, int tp) {
  top[u] = tp;
  s[dfn[u] = ++tim] = tmp[u];
  if (son[u]) dfs2(son[u], tp);
  for (auto v : E[u])
    if (v != fa[u] && v != son[u]) dfs2(v, v);
}
vector<pair<int, int> > get(int u, int v) {
  vector<pair<int, int> > A, B;
  while (top[u] != top[v]) {
    if (dep[top[u]] > dep[top[v]])
      A.push_back(make_pair(n - dfn[u] + 1, dfn[u] - dfn[top[u]] + 1)),
          u = fa[top[u]];
    else
      B.push_back(make_pair(dfn[top[v]], dfn[v] - dfn[top[v]] + 1)),
          v = fa[top[v]];
  }
  if (dep[u] > dep[v])
    A.push_back(make_pair(n - dfn[u] + 1, dfn[u] - dfn[v] + 1));
  else
    B.push_back(make_pair(dfn[u], dfn[v] - dfn[u] + 1));
  while (!B.empty()) A.push_back(B.back()), B.pop_back();
  return A;
}
int main() {
  n = gi();
  scanf("%s", tmp + 1);
  for (int i = 1, u, v; i < n; i++)
    u = gi(), v = gi(), E[u].push_back(v), E[v].push_back(u);
  dfs1(1, 0), dfs2(1, 1);
  for (int i = 1; i <= n; i++) s[n + n - i + 1] = s[i];
  n <<= 1;
  s[n + 1] = '\0';
  build();
  m = gi();
  while (m--) {
    int a = gi(), b = gi(), c = gi(), d = gi(), ans = 0;
    vector<pair<int, int> > A = get(a, b), B = get(c, d);
    for (int i = 0, j = 0; i < int(A.size()) && j < int(B.size());) {
      int k = min(lcp(A[i].first, B[j].first), min(A[i].second, B[j].second));
      ans += k;
      if (k < min(A[i].second, B[j].second)) break;
      if (A[i].second == k)
        ++i;
      else
        A[i].first += k, A[i].second -= k;
      if (B[j].second == k)
        ++j;
      else
        B[j].first += k, B[j].second -= k;
    }
    cout << ans << '\n';
  }
  return 0;
}
