#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 7;
int n, c[N], dif[N];
vector<int> e[N], g[N];
char s[N];
bool cmp(const int &x, const int &y) { return s[x] < s[y]; }
void dfsb(int u, int p) {
  for (int i = (0); i < (((int)(g[u]).size())); ++i) {
    int v = g[u][i];
    if (v == p) continue;
    e[u].push_back(v), dfsb(v, u);
  }
  sort((e[u]).begin(), (e[u]).end(), cmp);
}
int dfs(vector<pair<int, int> > &a) {
  if (((int)(a).size()) == 0) return 0;
  if (((int)(a).size()) == 1) return dif[a.front().first];
  int ret = 1;
  for (int c = (0); c < (26); ++c) {
    vector<pair<int, int> > b;
    for (int i = (0); i < (((int)(a).size())); ++i) {
      int u = a[i].first, &j = a[i].second;
      while (j < ((int)(e[u]).size()) && s[e[u][j]] == c)
        b.push_back(make_pair(e[u][j++], 0));
    }
    ret += dfs(b);
  }
  return ret;
}
void dfs(int u) {
  for (int i = (0); i < (((int)(e[u]).size())); ++i) dfs(e[u][i]);
  dif[u] = 1;
  for (int i = 0, j; i < ((int)(e[u]).size()); i = j) {
    j = i + 1;
    while (j < ((int)(e[u]).size()) && s[e[u][i]] == s[e[u][j]]) ++j;
    vector<pair<int, int> > a;
    for (int k = (i); k < (j); ++k) a.push_back(make_pair(e[u][k], 0));
    dif[u] += dfs(a);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = (1); i < (n + 1); ++i) scanf("%d", c + i);
  scanf(" %s", s + 1);
  for (int i = (1); i < (n + 1); ++i) s[i] -= 'a';
  for (int i = (1); i < (n); ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v), g[v].push_back(u);
  }
  dfsb(1, -1);
  dfs(1);
  int maxv = INT_MIN, cnt = 0;
  for (int i = (1); i < (n + 1); ++i) maxv = max(maxv, dif[i] + c[i]);
  for (int i = (1); i < (n + 1); ++i) cnt += maxv == dif[i] + c[i];
  printf("%d\n%d\n", maxv, cnt);
  return 0;
}
