#include <bits/stdc++.h>
using namespace std;
inline int ri() {
  int x;
  scanf("%d", &x);
  return x;
}
struct node {
  int size;
  node* chd[26];
  node() : size(1) { memset(chd, 0, sizeof(chd)); }
};
node* merge(node* a, node* b) {
  if (a == NULL) return b;
  if (b == NULL) return a;
  if (a->size < b->size) swap(a, b);
  a->size = 1;
  for (int i = 0; i < 26; i++) {
    a->chd[i] = merge(a->chd[i], b->chd[i]);
    a->size += a->chd[i] ? a->chd[i]->size : 0;
  }
  delete b;
  return a;
}
char s[400000];
int n, c[300001];
vector<int> g[300004];
node* dfs(int x, int pa) {
  node* cur = new node();
  for (int t : g[x])
    if (t != pa) {
      cur->chd[s[t] - 'a'] = merge(cur->chd[s[t] - 'a'], dfs(t, x));
    }
  for (int i = 0; i < 26; i++) cur->size += cur->chd[i] ? cur->chd[i]->size : 0;
  c[x] += cur->size;
  return cur;
}
int main() {
  n = ri();
  for (int i = 0; i < (n); i++) scanf("%d", c + i);
  scanf("%s", s);
  for (int i = 0; i < (n - 1); i++) {
    int u = ri(), v = ri();
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0, -1);
  vector<pair<int, int> > v;
  for (int i = 0; i < (n); i++) v.push_back(pair<int, int>(c[i], i));
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  cout << v[0].first << endl;
  int res = 0;
  for (int i = 0; i < (n); i++)
    if (v[i].first == v[0].first) res++;
  cout << res << endl;
  return 0;
}
