#include <bits/stdc++.h>
using namespace std;
const int N = 300001;
struct Trie {
  int distinct = 1;
  Trie* links[26] = {NULL};
  int calcDistinct() {
    distinct = 1;
    for (int i = 0; i < 26; i++) {
      if (links[i] != NULL) {
        distinct += links[i]->distinct;
      }
    }
    return distinct;
  }
  void operator+=(Trie* B) {
    if (B == NULL) return;
    for (int i = 0; i < 26; i++) {
      if (B->links[i]) {
        links[i] = links[i] ? links[i] : new Trie();
        (*links[i]) += B->links[i];
      }
    }
    calcDistinct();
  }
};
Trie* T[N];
int A[N];
int S[N];
char s[N];
vector<int> adj[N];
void dfs(int st, int p = -1) {
  S[st] = 1;
  int mx = -1;
  for (auto c : adj[st]) {
    if (c != p) {
      dfs(c, st);
      S[st] += S[c];
      if (mx == -1 || S[mx] < S[c]) mx = c;
    }
  }
  auto root = new Trie();
  if (mx == -1)
    root->links[s[st] - 'a'] = new Trie();
  else {
    for (auto c : adj[st]) {
      if (c != p && c != mx) (*T[mx]) += T[c];
    }
    root->links[s[st] - 'a'] = T[mx];
  }
  root->calcDistinct();
  T[st] = root;
  A[st] += T[st]->distinct - 1;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", A + i);
  }
  scanf("%s", s + 1);
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1);
  map<int, int> M;
  for (int i = 1; i <= n; i++) M[A[i]]++;
  printf("%d\n%d\n", M.rbegin()->first, M.rbegin()->second);
  return 0;
}
