#include <bits/stdc++.h>
using namespace std;
const int N = 300005, K = 21, T = 26;
template <class T>
void read(T &x) {
  int sgn = 1;
  char ch;
  x = 0;
  for (ch = getchar(); (ch < '0' || ch > '9') && ch != '-'; ch = getchar())
    ;
  if (ch == '-') ch = getchar(), sgn = -1;
  for (; '0' <= ch && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  x *= sgn;
}
template <class T>
void write(T x) {
  if (x < 0)
    putchar('-'), write(-x);
  else if (x < 10)
    putchar(x + '0');
  else
    write(x / 10), putchar(x % 10 + '0');
}
struct edge {
  int to, nxt;
} tree[N << 1];
int n, m, head[N], sz[N], child[N], dep[N], par[N], top[N], id[N], cnt = 0,
                                                                   tot = 0;
char str[N], S[N << 1];
void addedge(int u, int v) {
  edge e = {v, head[u]};
  tree[head[u] = cnt++] = e;
}
void dfs1(int u, int fa) {
  sz[u] = 1, child[u] = 0;
  for (int i = head[u]; ~i; i = tree[i].nxt) {
    int v = tree[i].to;
    if (v != fa) {
      dep[v] = dep[u] + 1;
      dfs1(v, u), sz[u] += sz[v];
      if (!child[u] || (sz[child[u]] < sz[v])) child[u] = v;
    }
  }
}
void dfs2(int u, int fa, int t) {
  id[u] = tot, par[u] = fa;
  top[u] = t, S[tot++] = str[u - 1];
  if (child[u]) dfs2(child[u], u, t);
  for (int i = head[u]; ~i; i = tree[i].nxt) {
    int v = tree[i].to;
    if (v != fa && v != child[u]) dfs2(v, u, v);
  }
}
int rk[N << 1], sa[N << 1], total[N << 1], rk_[N << 1], sa_[N << 1],
    height[N << 1][K], Log2[N << 1];
void build_sa() {
  sa[0] = sa_[0] = n << 1, rk[n << 1] = rk_[n << 1] = 0, Log2[1] = 0;
  for (int i = 0; i < T; i++) total[i] = 0;
  for (int i = 0; i < (n << 1); i++) total[S[i] - 'a'] = 1;
  for (int i = 1; i < T; i++) total[i] += total[i - 1];
  for (int i = 0; i < (n << 1); i++) rk[i] = total[S[i] - 'a'];
  for (int i = 0; i < T; i++) total[i] = 0;
  for (int i = 0; i < (n << 1); i++) total[S[i] - 'a']++;
  for (int i = 1; i < T; i++) total[i] += total[i - 1];
  for (int i = 0; i < (n << 1); i++) sa[total[S[i] - 'a']--] = i;
  for (int i = 2; i <= (n << 1); i++) Log2[i] = Log2[i >> 1] + 1;
  for (int i = 1; i < (n << 1); i <<= 1) {
    for (int j = 0; j <= (n << 1); j++) total[j] = 0;
    for (int j = 0; j < (n << 1); j++) total[rk[j]]++;
    for (int j = 1; j <= (n << 1); j++) total[j] += total[j - 1];
    for (int j = (n << 1); j >= 1; j--) {
      if (sa[j] >= i) sa_[total[rk[sa[j] - i]]--] = sa[j] - i;
    }
    for (int j = (n << 1) - i; j < (n << 1); j++) sa_[total[rk[j]]--] = j;
    for (int j = 1; j <= (n << 1); j++) {
      rk_[sa_[j]] = rk_[sa_[j - 1]];
      if (rk[sa_[j]] != rk[sa_[j - 1]] ||
          rk[min(n << 1, sa_[j] + i)] != rk[min(n << 1, sa_[j - 1] + i)])
        rk_[sa_[j]]++;
    }
    for (int j = 0; j <= (n << 1); j++) rk[j] = rk_[j], sa[j] = sa_[j];
  }
}
void build_height() {
  for (int i = 0, j = 0; i < (n << 1); i++, j = max(j - 1, 0)) {
    while (S[i + j] == S[sa[rk[i] - 1] + j]) j++;
    height[rk[i]][0] = j;
  }
  for (int i = 1; i <= (n << 1); i++) {
    for (int j = 1; j <= Log2[i]; j++)
      height[i][j] = min(height[i][j - 1], height[i - (1 << (j - 1))][j - 1]);
  }
}
int lcp(int u, int v) {
  if (u == v) return (n << 1) - u;
  int l = rk[u], r = rk[v];
  if (l > r) swap(l, r);
  int k = Log2[r - l];
  return min(height[r][k], height[l + (1 << k)][k]);
}
int calc(vector<pair<int, int> > vec1, vector<pair<int, int> > vec2) {
  int ans = 0;
  for (int i = 0, j = 0, pos1 = 0, pos2 = 0;
       i < vec1.size() && j < vec2.size();) {
    int len = min(vec1[i].second - vec1[i].first - pos1 + 1,
                  vec2[j].second - vec2[j].first - pos2 + 1);
    len = min(len, lcp(vec1[i].first + pos1, vec2[j].first + pos2)), ans += len;
    if (!len) break;
    pos1 += len, pos2 += len;
    if (pos1 > vec1[i].second - vec1[i].first) pos1 = 0, i++;
    if (pos2 > vec2[j].second - vec2[j].first) pos2 = 0, j++;
  }
  return ans;
}
vector<pair<int, int> > get_vec(int u, int v) {
  vector<pair<int, int> > vec1, vec2, vec;
  while (top[u] != top[v]) {
    if (dep[top[u]] >= dep[top[v]]) {
      vec1.push_back(
          make_pair((n << 1) - 1 - id[u], (n << 1) - 1 - id[top[u]]));
      u = par[top[u]];
    } else {
      vec2.push_back(make_pair(id[top[v]], id[v]));
      v = par[top[v]];
    }
  }
  for (int i = 0; i < vec1.size(); i++) vec.push_back(vec1[i]);
  if (dep[u] >= dep[v])
    vec.push_back(make_pair((n << 1) - 1 - id[u], (n << 1) - 1 - id[v]));
  else
    vec.push_back(make_pair(id[u], id[v]));
  for (int i = (int)vec2.size() - 1; i >= 0; i--) vec.push_back(vec2[i]);
  return vec;
}
int main() {
  read(n), scanf("%s", str);
  for (int i = 1; i <= n; i++) head[i] = -1;
  for (int i = 1; i < n; i++) {
    int u, v;
    read(u), read(v);
    addedge(u, v), addedge(v, u);
  }
  dep[1] = 0, dfs1(1, 0);
  dfs2(1, 0, 1);
  for (int i = n; i < (n << 1); i++) S[i] = S[(n << 1) - 1 - i];
  build_sa(), build_height();
  read(m);
  for (int i = 1; i <= m; i++) {
    int a, b, c, d;
    read(a), read(b), read(c), read(d);
    write(calc(get_vec(a, b), get_vec(c, d))), putchar('\n');
  }
  return 0;
}
