#include <bits/stdc++.h>
using namespace std;
inline long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
inline string get() {
  char ch[2000010];
  scanf("%s", ch);
  return ch;
}
inline void read(long long *a, long long n) {
  for (long long i = 0; i < n; i++) a[i] = in();
}
template <class blank>
inline void out(blank x) {
  cout << x << "\n";
  exit(0);
}
const long long maxn = 3e5 + 10;
const long long maxm = 1e6 + 10;
const long long maxlg = 20;
const long long base = 29;
const long long base2 = 31;
const long long mod2 = 1e9 + 9;
const long long mod = 1e9 + 7;
const long long INF = 1e18 + 10;
const long long SQ = 317 + 5;
long long c[maxn];
vector<long long> g[maxn];
struct Hash {
  long long hash1, hash2;
  inline bool operator<(const Hash &B) const {
    return make_pair(hash1, hash2) < make_pair(B.hash1, B.hash2);
  }
};
set<Hash> st[maxn];
string s;
long long maxi, cnt;
inline void dfs(long long node, long long fa = -1, long long a = 0,
                long long b = 0) {
  st[node].insert({a, b});
  for (auto u : g[node]) {
    if (u - fa) {
      dfs(u, node, (a * base + s[u]) % mod, (b * base2 + s[u]) % mod2);
      if (st[u].size() > st[node].size()) swap(st[node], st[u]);
      st[node].insert(st[u].begin(), st[u].end());
    }
  }
  if (st[node].size() + c[node] > maxi) {
    maxi = st[node].size() + c[node], cnt = 1;
  } else if (st[node].size() + c[node] == maxi)
    cnt++;
}
int32_t main() {
  long long n = in();
  read(c, n);
  s = get();
  for (long long i = 0; i < n - 1; i++) {
    long long v = in() - 1, u = in() - 1;
    g[v].push_back(u);
    g[u].push_back(v);
  }
  dfs(0, -1, s[0], s[0]);
  cout << maxi << " " << cnt << "\n";
}
