#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5, A = 26;
int node[N][A], c[N], sz[N];
string s;
int m = 0, rc = 0;
vector<int> adj[N];
int merge(int a, int b) {
  int x = s[b - 1] - 'a', ret = 0;
  if (node[a][x]) {
    int i;
    ret = 1;
    for (i = 0; i < 26; ++i)
      if (node[b][i]) ret += merge(node[a][x], node[b][i]);
  } else {
    node[a][x] = b;
  }
  return ret;
}
void dfs(int r, int p) {
  int i, u;
  sz[r] = 1;
  for (i = 0; i < adj[r].size(); ++i) {
    u = adj[r][i];
    if (u != p) {
      dfs(u, r);
      sz[r] += sz[u];
      sz[r] -= merge(r, u);
    }
  }
  if (m < c[r] + sz[r])
    m = c[r] + sz[r], rc = 1;
  else
    rc += (m == c[r] + sz[r]) ? 1 : 0;
}
int main() {
  int n, i, j, a, b;
  cin >> n;
  for (i = 1; i <= n; ++i) scanf("%d", &c[i]);
  cin >> s;
  for (i = 0; i < n - 1; ++i)
    scanf("%d%d", &a, &b), adj[a].push_back(b), adj[b].push_back(a);
  dfs(1, 0);
  cout << m << " " << rc << endl;
}
