#include <bits/stdc++.h>
using namespace std;
int n, letters = 26, m;
struct edgeType {
  int to, nxt;
} e[300010 << 1];
int head[300010];
int parent[300010];
int siz[300010], depth[300010];
int hs[300010], act[300010];
int qhyP[300010], zygP[300010];
int len;
char s[300010];
int str[600010];
int SA[600010], rk[600010];
int lastSA[600010], key[600010];
int cnt[600010];
int height[600010][22];
int qhy[300010], zyg[300010];
int lx[300010], fd[300010];
void add_edge(int u, int v, int x) {
  e[x].to = v;
  e[x].nxt = head[u];
  head[u] = x;
}
void get_string_and_edges() {
  int i, u, v;
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    add_edge(u, v, i * 2 - 1);
    add_edge(v, u, i * 2);
  }
}
void radix_sort(int upperbound, int L) {
  int i;
  int tmp0, tmp1;
  memset(cnt, 0, sizeof(int) * (upperbound + 3));
  for (i = 1; i <= len; i++) cnt[key[i]]++;
  for (i = 1; i <= upperbound; i++) cnt[i] += cnt[i - 1];
  for (i = len; i > 0; i--) SA[cnt[key[lastSA[i]]]--] = lastSA[i];
  for (i = 1, tmp0 = -1; i <= len; i++) {
    tmp1 = SA[i] + L <= len ? key[SA[i] + L] : -1;
    rk[SA[i]] = rk[SA[i - 1]] + (key[SA[i]] != key[SA[i - 1]] || tmp0 != tmp1);
    tmp0 = tmp1;
  }
}
int min(int x, int y) { return x < y ? x : y; }
int tmp;
int min_st(int l, int r) {
  if (l == r) return len - SA[l] + 1;
  if (r < l) l ^= r ^= l ^= r;
  l++;
  tmp = (int)(log(r - l + 1) / log(2));
  return min(height[l][tmp], height[r - (1 << tmp) + 1][tmp]);
}
void suffix_sort() {
  int i, j, k;
  for (i = 1; i <= len; i++) {
    key[i] = str[i];
    lastSA[i] = i;
  }
  radix_sort(26, 0);
  for (i = 1; i < len; i <<= 1) {
    for (j = 1; j <= i; j++) lastSA[j] = len - j + 1;
    for (k = 1; k <= len; k++) {
      if (SA[k] > i) lastSA[j++] = SA[k] - i;
      key[k] = rk[k];
    }
    radix_sort(len, i);
  }
  for (i = 1, k = 0; i <= len; i++) {
    if (rk[i] == 1) continue;
    j = SA[rk[i] - 1];
    while (i + k <= len && j + k <= len && str[i + k] == str[j + k]) k++;
    height[rk[i]][0] = k;
    k -= (k > 0);
  }
  for (i = 1; (1 << i) <= len; i++)
    for (j = 2; j + (1 << i) - 1 <= len; j++)
      height[j][i] = min(height[j][i - 1], height[j + (1 << (i - 1))][i - 1]);
}
void dfs0(int x, int p) {
  int i;
  siz[x] = 1;
  depth[x] = depth[p] + 1;
  parent[x] = p;
  for (i = head[x]; i; i = e[i].nxt)
    if (e[i].to != p) {
      dfs0(e[i].to, x);
      siz[x] += siz[e[i].to];
      if (siz[hs[x]] < siz[e[i].to]) hs[x] = e[i].to;
    }
}
void dfs1(int x, int p) {
  int i;
  str[++len] = s[x] - 'a' + 1;
  qhyP[x] = len;
  if (hs[x]) {
    act[hs[x]] = act[x];
    dfs1(hs[x], x);
  }
  for (i = head[x]; i; i = e[i].nxt)
    if (e[i].to != p && e[i].to != hs[x]) {
      act[e[i].to] = e[i].to;
      dfs1(e[i].to, x);
    }
}
void dfs2(int x, int p) {
  int i;
  for (i = head[x]; i; i = e[i].nxt)
    if (e[i].to != p && e[i].to != hs[x]) {
      dfs2(e[i].to, x);
    }
  if (hs[x]) dfs2(hs[x], x);
  str[++len] = s[x] - 'a' + 1;
  zygP[x] = len;
}
void standing_by() {
  get_string_and_edges();
  dfs0(1, 0);
  dfs1(act[1] = 1, 0);
  dfs2(1, 0);
  suffix_sort();
}
void get_link(int u, int v) {
  int i;
  qhy[0] = zyg[0] = 0;
  while (act[u] != act[v]) {
    if (depth[act[u]] > depth[act[v]]) {
      zyg[++zyg[0]] = u;
      zyg[++zyg[0]] = act[u];
      u = parent[act[u]];
    } else {
      qhy[++qhy[0]] = v;
      qhy[++qhy[0]] = act[v];
      v = parent[act[v]];
    }
  }
  if (depth[u] < depth[v]) {
    qhy[++qhy[0]] = v;
    qhy[++qhy[0]] = u;
  } else {
    zyg[++zyg[0]] = u;
    zyg[++zyg[0]] = v;
  }
}
void complete() {
  int i, j, u, v, k;
  int ans;
  scanf("%d", &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    get_link(u, v);
    lx[0] = 0;
    for (j = 1; j <= zyg[0]; j++) lx[++lx[0]] = zygP[zyg[j]];
    for (j = qhy[0]; j > 0; j--) lx[++lx[0]] = qhyP[qhy[j]];
    scanf("%d%d", &u, &v);
    get_link(u, v);
    fd[0] = 0;
    for (j = 1; j <= zyg[0]; j++) fd[++fd[0]] = zygP[zyg[j]];
    for (j = qhy[0]; j > 0; j--) fd[++fd[0]] = qhyP[qhy[j]];
    ans = 0;
    for (u = 1, v = 1; u <= lx[0] && v <= fd[0];) {
      k = min_st(rk[lx[u]], rk[fd[v]]);
      k = min(k, lx[u + 1] - lx[u] + 1);
      k = min(k, fd[v + 1] - fd[v] + 1);
      ans += k;
      if (k < lx[u + 1] - lx[u] + 1 && k < fd[v + 1] - fd[v] + 1)
        break;
      else {
        lx[u] += k;
        fd[v] += k;
        if (lx[u] > lx[u + 1]) u += 2;
        if (fd[v] > fd[v + 1]) v += 2;
      }
    }
    printf("%d\n", ans);
  }
}
int main() {
  standing_by();
  complete();
  return 0;
}
