#include <bits/stdc++.h>
using namespace std;
const unsigned long long P = 127;
const unsigned long long Q = 480314964;
const unsigned long long R = 1000000007;
const int MAXN = 300005;
const int K = 19;
unsigned long long U[MAXN];
int clz[1 << K];
int N, M;
char S[MAXN];
vector<int> adj[MAXN];
unsigned long long up[MAXN], dn[MAXN];
int A[K][MAXN], D[MAXN];
int far[MAXN], lc[MAXN];
int *id[MAXN], ch[MAXN];
int path[2 * MAXN], *ptr = path;
void dfs(int v, int p) {
  A[0][v] = p;
  D[v] = D[p] + 1;
  up[v] = (P * up[p] + S[v]) % R;
  dn[v] = (Q * dn[p] + S[v]) % R;
  for (int n : adj[v]) {
    if (n == p) continue;
    dfs(n, v);
    if (far[n] + 1 > far[v]) {
      lc[v] = n;
      far[v] = far[n] + 1;
    }
  }
  ch[lc[v]] = 1;
}
inline int jump(int a, int d) {
  if (d == 0) return a;
  int k = clz[d];
  d ^= 1 << k;
  return id[A[k][a]][-d];
}
inline int lca(int a, int b) {
  if (D[a] < D[b]) swap(a, b);
  a = jump(a, D[a] - D[b]);
  if (a == b) return a;
  for (int i = K - 1; i >= 0; i--) {
    if (A[i][a] != A[i][b]) {
      a = A[i][a];
      b = A[i][b];
    }
  }
  return A[0][a];
}
inline unsigned long long get(int a, int b, int l, int k) {
  if (k <= D[a] - D[l]) {
    int v = jump(a, k);
    return (up[a] - U[k] * up[v] % R + R) % R;
  } else {
    int da = D[a] - D[l];
    int db = D[b] - D[l];
    int v = jump(b, da + db + 1 - k);
    int dv = D[v] - D[l];
    unsigned long long up_hash = (up[a] - U[da] * up[l] % R + R) % R;
    unsigned long long dn_hash = (U[dv] * dn[v] % R - dn[l] + R) % R;
    return (up_hash + U[da] * (S[l] + dn_hash)) % R;
  }
}
void init() {
  U[0] = 1;
  for (int i = 0; i < MAXN; i++) {
    U[i + 1] = P * U[i] % R;
    clz[i] = 31 - __builtin_clz(i);
  }
}
void build() {
  scanf("%d%s", &N, S + 1);
  for (int i = 1; i < N; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  D[0] = -1;
  dfs(1, 0);
  for (int i = 0; i + 1 < K; i++) {
    for (int j = 1; j <= N; j++) {
      A[i + 1][j] = A[i][A[i][j]];
    }
  }
  for (int i = 1; i <= N; i++) {
    if (ch[i]) continue;
    int u = A[0][i], v = i;
    int k = min(D[i], far[i]);
    for (int j = 1; j <= k; j++) {
      ptr[k - j] = u;
      u = A[0][u];
    }
    ptr += k;
    while (v > 0) {
      id[v] = ptr;
      *ptr++ = v;
      v = lc[v];
    }
  }
}
void solve() {
  scanf("%d", &M);
  for (int i = 0; i < M; i++) {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    int l = lca(a, b), m = lca(c, d);
    int u = D[a] + D[b] - 2 * D[l] + 1;
    int v = D[c] + D[d] - 2 * D[m] + 1;
    int lo = 0, hi = min(u, v) + 1;
    while (lo + 1 < hi) {
      int mid = (lo + hi) / 2;
      unsigned long long g = get(a, b, l, mid);
      unsigned long long h = get(c, d, m, mid);
      (g == h ? lo : hi) = mid;
    }
    printf("%d\n", lo);
  }
}
int main() {
  init();
  build();
  solve();
}
