#include <bits/stdc++.h>
using namespace std;
template <class P, class Q>
inline void smin(P &a, Q b) {
  if (b < a) a = b;
}
template <class P, class Q>
inline void smax(P &a, Q b) {
  if (a < b) a = b;
}
const int maxn = 300000 + 100;
const int maxlg = 20;
const int base = 727;
const int mod = 1000000000 + 7;
long long pw[maxn];
long long pw2[maxn];
int n, m;
char s[maxn];
vector<int> adj[maxn];
int dep[maxn];
int par[maxn][maxlg];
long long up[maxn][maxlg], dw[maxn][maxlg];
int up2[maxn][maxlg], dw2[maxn][maxlg];
inline int nextInt() {
  register char ch;
  register int res;
  while ((ch = getchar()) < '0')
    ;
  for (res = ch - '0'; (ch = getchar()) >= '0'; res = res * 10 + ch - '0')
    ;
  return res;
}
void writen(register int Q) {
  static char W[12], E;
  W[11] = '\n';
  for (W[0xA] = Q % 0xA + 0x30, Q /= 0xA, E = 0xA; Q;
       W[(int)--E] = Q % 0xA + 0x30, Q /= 0xA)
    ;
  fwrite(W + E, 0x1, 0xC - E, stdout);
}
void dfs(int u, int parent, int depth) {
  dep[u] = depth;
  par[u][0] = parent;
  up[u][0] = dw[u][0] = s[u];
  up2[u][0] = dw2[u][0] = s[u];
  for (int i = (int)(1), _n = (int)(maxlg); i < _n; i++) {
    par[u][i] = par[par[u][i - 1]][i - 1];
    up[u][i] = up[u][i - 1] * pw[1 << (i - 1)] + up[par[u][i - 1]][i - 1];
    dw[u][i] = dw[par[u][i - 1]][i - 1] * pw[1 << (i - 1)] + dw[u][i - 1];
    up2[u][i] =
        (up2[u][i - 1] * pw2[1 << (i - 1)] + up2[par[u][i - 1]][i - 1]) % mod;
    dw2[u][i] =
        (dw2[par[u][i - 1]][i - 1] * pw2[1 << (i - 1)] + dw2[u][i - 1]) % mod;
  }
  for (int v : adj[u])
    if (v != parent) dfs(v, u, depth + 1);
}
int lca(int u, int v) {
  if (dep[u] > dep[v]) swap(u, v);
  for (int i = (int)(maxlg), _x = (int)(0); i-- > _x;)
    if (dep[par[v][i]] >= dep[u]) v = par[v][i];
  if (u == v) return u;
  for (int i = (int)(maxlg), _x = (int)(0); i-- > _x;)
    if (par[u][i] != par[v][i]) u = par[u][i], v = par[v][i];
  return par[u][0];
}
inline int depkpar(int u, int depth) {
  for (int i = (int)(maxlg), _x = (int)(0); i-- > _x;)
    if (dep[par[u][i]] >= depth) u = par[u][i];
  return u;
}
int solve(int a, int b, int c, int d) {
  int x = lca(a, b), y = lca(c, d);
  int ans = 0;
  for (int i = (int)(maxlg), _x = (int)(0); i-- > _x;)
    if ((1 << i) <= min(dep[a] - dep[x], dep[c] - dep[y]) + 1)
      if (up[a][i] == up[c][i] && up2[a][i] == up2[c][i])
        ans += 1 << i, a = par[a][i], c = par[c][i];
  if (dep[a] >= dep[x] && dep[c] >= dep[y]) return ans;
  if (dep[a] < dep[x]) swap(a, c), swap(b, d), swap(x, y);
  c = y;
  for (int i = (int)(maxlg), _x = (int)(0); i-- > _x;)
    if ((1 << i) <= dep[d] - dep[y] && (1 << i) <= dep[a] - dep[x] + 1) {
      int pd = depkpar(d, dep[y] + (1 << i));
      if (up[a][i] == dw[pd][i] && up2[a][i] == dw2[pd][i])
        ans += 1 << i, a = par[a][i], y = pd;
    }
  if (dep[a] >= dep[x] || (dep[a] < dep[x] && x == b) || y == d) return ans;
  a = x;
  for (int i = (int)(maxlg), _x = (int)(0); i-- > _x;)
    if ((1 << i) <= min(dep[b] - dep[x], dep[d] - dep[y])) {
      int push_back = depkpar(b, dep[x] + (1 << i));
      int pd = depkpar(d, dep[y] + (1 << i));
      if (dw[push_back][i] == dw[pd][i] && dw2[push_back][i] == dw2[pd][i])
        ans += 1 << i, x = push_back, y = pd;
    }
  return ans;
}
int main() {
  pw[0] = 1;
  for (int i = (int)(1), _n = (int)(maxn); i < _n; i++)
    pw[i] = pw[i - 1] * base;
  pw2[0] = 1;
  for (int i = (int)(1), _n = (int)(maxn); i < _n; i++)
    pw2[i] = pw2[i - 1] * base % mod;
  n = nextInt();
  scanf("%s", s);
  for (int i = 0, _n = (int)(n - 1); i < _n; i++) {
    int u, v;
    u = nextInt(), v = nextInt(), u--, v--;
    adj[u].push_back(v), adj[v].push_back(u);
  }
  adj[0].push_back(n), adj[n].push_back(0);
  dfs(n, n, 0);
  cin >> m;
  for (int z = 0, _n = (int)(m); z < _n; z++) {
    int a, b, c, d;
    a = nextInt(), b = nextInt(), c = nextInt(), d = nextInt();
    a--, b--, c--, d--;
    writen(solve(a, b, c, d));
  }
  return 0;
}
