#include <bits/stdc++.h>
using namespace std;
const int maxn = 600100;
int n, c[maxn], head[maxn], ch[maxn][30], sz, ori[maxn], ansc, cnt, cha[maxn];
char s[maxn];
int sum[maxn], ans = -1, a[maxn], val[maxn];
struct hh {
  int next, to;
} seg[maxn];
void add_seg(int s, int t) {
  seg[++cnt] = (hh){head[s], t};
  head[s] = cnt;
  seg[++cnt] = (hh){head[t], s};
  head[t] = cnt;
}
int merge(int rt, int no) {
  long long fuck = 0;
  if (ch[rt][cha[no]] == 0) {
    ch[rt][cha[no]] = no;
    val[rt] += val[no];
    return val[no];
  }
  for (int i = 1; i <= 27; i++)
    if (ch[no][i] != 0) fuck += merge(ch[rt][cha[no]], ch[no][i]);
  val[rt] += fuck;
  return fuck;
}
int dfs(int cur, int tr, int fa) {
  sum[cur]++;
  cha[tr] = c[cur];
  int son = 0;
  for (int i = head[cur]; i != 0; i = seg[i].next)
    if (seg[i].to != fa) {
      son++;
      if (son == 1) {
        ch[tr][c[seg[i].to]] = ++sz;
        sum[cur] += dfs(seg[i].to, sz, cur);
      } else {
        int lover = ++sz;
        dfs(seg[i].to, lover, cur);
        sum[cur] += merge(tr, lover);
      }
    }
  val[tr] = sum[cur];
  return sum[cur];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) c[i] = s[i] - 'a' + 1;
  for (int i = 1; i < n; i++) {
    int fr, to;
    scanf("%d%d", &fr, &to);
    add_seg(fr, to);
  }
  sz = 1;
  dfs(1, 1, 0);
  for (int i = 1; i <= n; i++) {
    if (a[i] + sum[i] > ans) {
      ans = a[i] + sum[i];
      ansc = 1;
    } else if (a[i] + sum[i] == ans)
      ansc++;
  }
  printf("%d\n%d\n", ans, ansc);
  return 0;
}
