#include <bits/stdc++.h>
using namespace std;
const int N = 300100;
int n, c[N], ans, way;
char s[N];
vector<int> g[N];
struct node {
  int sum;
  node* son[26];
  node() { sum = 0; }
};
node* null;
node* b[N];
node* newnode() {
  node* res = new node();
  for (int i = 0; i < 26; ++i) res->son[i] = null;
  return res;
}
void go(node* u, node* v) {
  u->sum = 1;
  for (int i = 0; i < 26; ++i) {
    if (v->son[i] == null) continue;
    if (u->son[i] == null)
      u->son[i] = v->son[i];
    else
      go(u->son[i], v->son[i]);
  }
  for (int i = 0; i < 26; ++i) u->sum += u->son[i]->sum;
}
node* merge(node* u, node* v) {
  if (u->sum < v->sum) swap(u, v);
  go(u, v);
  return u;
}
void dfs(int v, int par) {
  b[v] = newnode();
  b[v]->sum = 1;
  for (int u : g[v])
    if (u != par) {
      dfs(u, v);
      node* foo = newnode();
      foo->son[s[u] - 'a'] = b[u];
      foo->sum = b[u]->sum + 1;
      b[u] = foo;
      b[v] = merge(b[v], b[u]);
    }
  if (b[v]->sum + c[v] == ans) ++way;
  if (b[v]->sum + c[v] > ans) {
    ans = b[v]->sum + c[v];
    way = 1;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  null = new node();
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> c[i];
  if (n == 1) {
    cout << c[1] + 1 << '\n' << 1 << '\n';
    return 0;
  }
  cin >> s + 1;
  for (int u, v, i = 1; i < n; ++i) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 0);
  cout << ans << '\n' << way << '\n';
  return 0;
}
