#include <bits/stdc++.h>
using namespace std;
const int N = 300001;
const long long int MOD1 = 1000000007LL, MOD2 = 1000000009LL;
int A[N], S[N], P[N];
char s[N];
set<pair<long long int, long long int> > T[N];
vector<int> adj[N];
void merge(int u, int v) {
  if (T[u].size() > T[v].size()) {
    T[u].insert(T[v].begin(), T[v].end());
    T[v].clear();
  } else {
    swap(u, v);
    T[u].insert(T[v].begin(), T[v].end());
    T[u].swap(T[v]);
  }
}
void dfs(int st, int p = 1, long long int H1 = 0LL, long long int H2 = 0LL) {
  H1 = (H1 * 257LL + s[st] - 'a' + 1) % MOD1;
  H2 = (H2 * 43LL + s[st] - 'a' + 1) % MOD2;
  S[st] = 1;
  T[st].insert({H1, H2});
  for (auto c : adj[st]) {
    if (c != p) {
      dfs(c, st, H1, H2), S[st] += S[c];
      merge(st, c);
    }
  }
  A[st] += T[st].size();
}
int main() {
  int n, u, v;
  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++) {
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1);
  int mxc = 0, mx = 1;
  for (int i = 1; i <= n; i++) {
    if (mx == A[i])
      mxc++;
    else if (mx < A[i])
      mx = A[i], mxc = 1;
  }
  printf("%d\n%d\n", mx, mxc);
  return 0;
}
