#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9);
const double eps = 1e-4;
const double pi = 4 * atan(double(1));
const int N = int(3e5) + 100;
const int LOG = 19;
const int M = int(1e6) + 100;
const int X1 = 4243;
const int X2 = 10007;
const int MOD1 = int(1e9) + 7;
const int MOD2 = 42424243;
struct _hash {
  int a;
  _hash() {}
  _hash(int a) : a(a) {}
};
_hash operator+(const _hash &a, const _hash &b) {
  _hash c(a.a + b.a);
  if (c.a >= MOD1) {
    c.a -= MOD1;
  }
  return c;
}
_hash operator-(const _hash &a, const _hash &b) {
  _hash c(a.a - b.a);
  if (c.a < 0) {
    c.a += MOD1;
  }
  return c;
}
_hash operator*(const _hash &a, const _hash &b) {
  return _hash((1LL * a.a * b.a) % MOD1);
}
bool operator==(const _hash &a, const _hash &b) { return a.a == b.a; }
const _hash X(X1);
struct tq {
  int a, b, ab, c, d, cd;
};
struct query {
  int pv, pu, u, num;
  query(int pv, int pu, int u, int num) : pv(pv), pu(pu), u(u), num(num) {}
};
int n, sz;
bool used[N];
char s[N];
int _prev[N], _rank[N], val[N], h[N], st[N];
int p[LOG][N];
tq q[M];
int ans[M];
vector<int> g[N];
vector<pair<int, int *> > lca[N];
vector<query> queries[N];
_hash sum[N], sum_rev[N], pw[2 * N];
inline void add(int a, int b, int *ab) {
  lca[a].push_back(make_pair(b, ab));
  lca[b].push_back(make_pair(a, ab));
}
int get(int a) {
  if (_prev[a] != a) {
    _prev[a] = get(_prev[a]);
  }
  return _prev[a];
}
inline void merge(int a, int b, int c) {
  a = get(a);
  b = get(b);
  if (_rank[a] < _rank[b]) {
    swap(a, b);
  }
  _prev[b] = a;
  if (_rank[a] == _rank[b]) {
    ++_rank[a];
  }
  val[a] = c;
}
void dfs(int v, int pv = -1) {
  p[0][v] = pv;
  used[v] = true;
  if (pv != -1) {
    g[v].erase(find((g[v]).begin(), (g[v]).end(), pv));
    h[v] = h[pv] + 1;
  } else {
    h[v] = 0;
  }
  sum[v] = (pv == -1 ? _hash(0) : sum[pv]) + pw[h[v]] * _hash(s[v]);
  sum_rev[v] = (pv == -1 ? _hash(0) : sum_rev[pv]) + pw[n - h[v]] * _hash(s[v]);
  for (int i = 0; i < int((lca[v]).size()); ++i) {
    if (used[lca[v][i].first]) {
      *(lca[v][i].second) = val[get(lca[v][i].first)];
    }
  }
  for (int i = 0; i < int((g[v]).size()); ++i) {
    dfs(g[v][i], v);
    merge(g[v][i], v, v);
  }
}
inline int up(int v, int need) {
  if (need == 0) {
    return v;
  }
  for (int i = LOG - 1; i >= 0; --i) {
    if (need >= (1 << i)) {
      v = p[i][v];
      need -= (1 << i);
    }
  }
  return v;
}
inline _hash get_sum_rev(int v, int pv) {
  return (sum_rev[v] - (p[0][pv] == -1 ? _hash(0) : sum_rev[p[0][pv]])) *
         pw[h[v]];
}
inline int up(int v, int u, int pv) {
  int res = 0;
  for (int i = LOG - 1; i >= 0; --i) {
    if (p[i][v] != -1 && h[p[i][v]] >= h[pv]) {
      int nv = p[i][v];
      int nu = p[i][u];
      if (get_sum_rev(v, nv) == get_sum_rev(u, nu)) {
        res += (1 << i);
        v = nv;
        u = nu;
      }
    }
  }
  if (s[v] == s[u]) {
    ++res;
  }
  return res;
}
inline _hash get_sum(int v, int pv) {
  return (sum[v] - (p[0][pv] == -1 ? _hash(0) : sum[p[0][pv]])) * pw[n - h[pv]];
}
inline int down(int pv, int v, int pu, int u) {
  if (h[v] - h[pv] > h[u] - h[pu]) {
    swap(v, u);
    swap(pv, pu);
  }
  u = up(u, (h[u] - h[pu]) - (h[v] - h[pv]));
  int res = 0;
  for (int i = LOG - 1; i >= 0; --i) {
    if (p[i][v] != -1 && h[p[i][v]] > h[pv]) {
      int nv = p[i][v];
      int nu = p[i][u];
      if (get_sum_rev(nv, pv) == get_sum_rev(nu, pu)) {
        res += (h[v] - h[pv]) - (1 << i);
        pv = nv;
        pu = nu;
      } else {
        v = nv;
        u = nu;
      }
    }
  }
  if (pv != v && s[v] == s[u]) {
    ++res;
  }
  return res;
}
inline void process(int a, int b, int ab, int c, int d, int cd, int num) {
  if (h[a] - h[ab] > h[c] - h[cd]) {
    swap(a, c);
    swap(b, d);
    swap(ab, cd);
  }
  int tmp = up(c, h[a] - h[ab]);
  if (get_sum_rev(a, ab) == get_sum_rev(c, tmp)) {
    if (tmp == cd) {
      ans[num] = (h[a] - h[ab] + 1) + down(ab, b, cd, d);
    } else {
      int len = min(h[b] - h[ab], h[tmp] - h[cd]);
      int tmp2 = up(b, (h[b] - h[ab]) - len);
      int tmp3 = up(tmp, len);
      if (get_sum(tmp2, ab) == get_sum_rev(tmp, tmp3)) {
        ans[num] = (h[a] - h[ab] + 1) + (h[tmp2] - h[ab]);
        if (tmp3 == cd) {
          ans[num] += down(tmp2, b, cd, d);
        }
      } else {
        ans[num] = (h[a] - h[ab] + 1);
        queries[tmp2].push_back(query(ab, tmp3, tmp, num));
      }
    }
  } else {
    ans[num] = up(a, c, ab);
  }
}
int cnt = 0;
void dfs2(int v) {
  ++cnt;
  st[sz++] = v;
  for (int i = 0; i < int((queries[v]).size()); ++i) {
    int pv = queries[v][i].pv, pu = queries[v][i].pu, u = queries[v][i].u,
        num = queries[v][i].num;
    for (int j = LOG - 1; j >= 0; --j) {
      if (p[j][u] != -1 && h[p[j][u]] >= h[pu]) {
        int nu = p[j][u];
        int nv = st[sz - 1 - (h[v] - h[pv]) + (1 << j)];
        if (get_sum_rev(u, nu) == get_sum(nv, pv)) {
          ans[num] += (1 << j);
          u = nu;
          pv = nv;
        }
      }
    }
  }
  for (int i = 0; i < int((g[v]).size()); ++i) {
    dfs2(g[v][i]);
  }
  --sz;
}
int main() {
  scanf("%d", &n);
  gets(s);
  gets(s);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d %d %d", &q[i].a, &q[i].b, &q[i].c, &q[i].d);
    --q[i].a;
    --q[i].b;
    --q[i].c;
    --q[i].d;
    add(q[i].a, q[i].b, &q[i].ab);
    add(q[i].c, q[i].d, &q[i].cd);
  }
  for (int i = 0; i < n; ++i) {
    _prev[i] = i;
    _rank[i] = 1;
    val[i] = i;
  }
  pw[0] = _hash(1);
  for (int i = 1; i <= 2 * n; ++i) {
    pw[i] = pw[i - 1] * X;
  }
  dfs(0);
  for (int i = 1; i < LOG; ++i) {
    for (int j = 0; j < n; ++j) {
      if (p[i - 1][j] == -1) {
        p[i][j] = -1;
        continue;
      }
      p[i][j] = p[i - 1][p[i - 1][j]];
    }
  }
  for (int i = 0; i < m; ++i) {
    process(q[i].a, q[i].b, q[i].ab, q[i].c, q[i].d, q[i].cd, i);
  }
  sz = 0;
  dfs2(0);
  for (int i = 0; i < m; ++i) {
    printf("%d\n", ans[i]);
  }
  return 0;
}
