#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
const long long hgs1 = 1e13 + 7, hgs2 = 1e11 + 7;
struct node {
  long long h1, h2;
  friend bool operator<(node A, node B) { return A.h1 < B.h1; }
} a[N];
int cnt, t, n, ans[N], val[N], base1 = 133, base2 = 31;
char ch[N];
set<node> s[N];
vector<int> v[N];
void dfs(int x, int fa) {
  a[x].h1 = (a[fa].h1 * base1 + (int)ch[x]) % hgs1;
  a[x].h2 = (a[fa].h2 * base2 + (int)ch[x]) % hgs2;
  s[x].insert(a[x]);
  int l = v[x].size() - 1, y;
  for (register int i = (0); i <= (l); ++i) {
    y = v[x][i];
    if (y == fa) continue;
    dfs(y, x);
    if (s[y].size() > s[x].size()) swap(s[x], s[y]);
    s[x].insert(s[y].begin(), s[y].end());
  }
  ans[x] = s[x].size() + val[x];
  t = max(t, ans[x]);
}
signed main() {
  int x, y;
  scanf("%d", &n);
  for (register int i = (1); i <= (n); ++i) scanf("%d", &val[i]);
  scanf("%s", ch + 1);
  for (register int i = (2); i <= (n); ++i) {
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(1, 0);
  for (register int i = (1); i <= (n); ++i) cnt += (ans[i] == t);
  printf("%d \n%d \n", t, cnt);
  return 0;
}
