#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using pi3 = pair<pii, int>;
const int NN = 6e5 + 1e2;
const int MM = 20;
int n, pa[NN][MM], dep[NN];
int to[NN], head[NN], nxt[NN], E;
inline void add_edge(int u, int v) {
  nxt[E] = head[u];
  to[E] = v;
  head[u] = E++;
}
char s[NN];
pi3 pos[NN];
int rk[NN][MM];
void TreeSuffixArray() {
  for (int i = 1; i <= n; i++) rk[i][0] = rk[i + n][0] = s[i];
  for (int j = 1; j < MM; j++) {
    for (int i = 1; i <= n; i++) {
      int rt = pa[i][j - 1];
      if (~rt) {
        pos[i] = {{rk[i][j - 1], rk[rt][j - 1]}, i};
        pos[i + n] = {{rk[rt + n][j - 1], rk[i + n][j - 1]}, i + n};
      } else {
        pos[i] = {{rk[i][j - 1], 0}, i};
        pos[i + n] = {{0, rk[i + n][j - 1]}, i + n};
      }
    }
    sort(pos + 1, pos + n + n + 1);
    int cnt = 0;
    for (int i = 1; i <= (n << 1); i++) {
      rk[pos[i].second][j] = cnt + 1;
      cnt += (pos[i].first != pos[i + 1].first);
    }
  }
}
void dfs(int u, int dp = 0, int fa = -1) {
  pa[u][0] = fa;
  dep[u] = dp;
  for (int e = head[u]; ~e; e = nxt[e]) {
    if (to[e] == fa) continue;
    dfs(to[e], dp + 1, u);
  }
}
inline int kth(int u, int k) {
  for (int i = MM; i--;)
    if (k & (1 << i)) u = pa[u][i];
  return u;
}
inline int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  u = kth(u, dep[u] - dep[v]);
  if (u == v) return u;
  for (int i = MM; i--;) {
    if (~pa[u][i] && pa[u][i] != pa[v][i]) {
      u = pa[u][i];
      v = pa[v][i];
    }
  }
  return pa[u][0];
}
inline int Lcp(int a, int b, int len) {
  if (!len) return 0;
  int lcp = 0;
  for (int i = MM; i--;) {
    if (lcp + (1 << i) > len) continue;
    if (rk[a > n ? kth(a - n, len - lcp - (1 << i)) + n : a][i] ==
        rk[b > n ? kth(b - n, len - lcp - (1 << i)) + n : b][i]) {
      if (a <= n) a = pa[a][i];
      if (b <= n) b = pa[b][i];
      lcp += (1 << i);
    }
  }
  return lcp;
}
int Lcp(int a, int b, int c, int d) {
  int u = lca(a, b), v = lca(c, d);
  if (dep[a] - dep[u] < dep[c] - dep[v]) swap(a, c), swap(b, d), swap(u, v);
  int lcp = 0, len, tmp, aa, bb, D;
  len = dep[c] - dep[v];
  lcp += (tmp = Lcp(a, c, len));
  if (tmp != len) return lcp;
  a = kth(a, len);
  aa = dep[a] - dep[u] + 1;
  bb = dep[d] - dep[v] + 1;
  if (aa >= bb) return lcp + Lcp(a, d + n, bb);
  D = kth(d, bb - aa);
  lcp += (tmp = Lcp(a, D + n, aa));
  if (tmp < aa) return lcp;
  aa = dep[b] - dep[u];
  bb = dep[d] - dep[D];
  if (aa > bb)
    b = kth(b, aa - bb);
  else
    d = kth(d, bb - aa);
  return lcp + Lcp(b + n, d + n, min(aa, bb));
}
int main() {
  memset(head, 0xff, sizeof head);
  memset(pa, -1, sizeof pa);
  scanf("%d %s", &n, s + 1);
  for (int i = 1, u, v; i < n; i++) {
    scanf("%d %d", &u, &v);
    add_edge(u, v);
    add_edge(v, u);
  }
  dfs(1);
  for (int j = 1; j < MM; j++) {
    for (int i = 1; i <= n; i++) {
      if (~pa[i][j - 1]) pa[i][j] = pa[pa[i][j - 1]][j - 1];
    }
  }
  TreeSuffixArray();
  int test;
  scanf("%d", &test);
  for (int a, b, c, d; test--;) {
    scanf("%d %d %d %d", &a, &b, &c, &d);
    printf("%d\n", Lcp(a, b, c, d));
  }
  return 0;
}
