#include <bits/stdc++.h>
using namespace std;
const int N = 300100;
const long long P = 31525197391593473;
int n;
int tree[N];
void update(int k, int x) {
  for (; k <= n; k += k & -k) tree[k] += x;
}
int query(int k) {
  int ans = 0;
  for (; k; k -= k & -k) ans += tree[k];
  return ans;
}
vector<int> son[N];
long long col[N];
int last[N], ans[N], cnt;
void solve(int u, int f) {
  ++cnt;
  if (last[col[u]]) update(last[col[u]], -1);
  update(cnt, 1);
  last[col[u]] = cnt;
  int L = cnt;
  for (int v : son[u])
    if (v != f) solve(v, u);
  int R = cnt;
  ans[u] += query(R) - query(L - 1);
}
char s[N];
void getcol(int u, int f, long long color) {
  col[u] = color;
  for (int v : son[u])
    if (v != f) {
      long long newcol = (color * 31 + s[v] - 'a' + 1) % P;
      getcol(v, u, newcol);
    }
}
vector<long long> vec;
void getcol() {
  for (int i = 1; i <= n; i++) vec.push_back(col[i]);
  sort(vec.begin(), vec.end());
  vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
  for (int i = 1; i <= n; i++)
    col[i] = lower_bound(vec.begin(), vec.end(), col[i]) - vec.begin() + 1;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf(" %d", ans + i);
  for (int i = 1; i <= n; i++) scanf(" %c", s + i);
  for (int i = 2; i <= n; i++) {
    int t, v;
    scanf("%d%d", &t, &v);
    son[t].push_back(v);
    son[v].push_back(t);
  }
  getcol(1, 0, 1);
  getcol();
  solve(1, 0);
  int res = 0, tot = 0;
  for (int i = 1; i <= n; i++) res = max(res, ans[i]);
  for (int i = 1; i <= n; i++) tot += ans[i] == res;
  printf("%d %d\n", res, tot);
  return 0;
}
