#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 10;
long long h[N], ne[N], e[N], idx;
long long w[N], st[N], rt, sz[N];
long long f[N * 10];
long long ans[N];
void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx++; }
void dfs_rt(int u, int fa, int tot) {
  int i;
  sz[u] = 1;
  long long mx = 0;
  for (i = h[u]; i != -1; i = ne[i]) {
    int j = e[i];
    if (j == fa || st[j]) continue;
    dfs_rt(j, u, tot);
    sz[u] += sz[j];
    mx = max(mx, sz[j]);
  }
  mx = max(mx, tot - sz[u]);
  if (mx * 2 <= tot) {
    rt = u;
  }
}
void dfs_sz(int u, int fa) {
  sz[u] = 1;
  int i;
  for (i = h[u]; i != -1; i = ne[i]) {
    int j = e[i];
    if (j == fa || st[j]) continue;
    dfs_sz(j, u);
    sz[u] += sz[j];
  }
}
void build(int u, int fa, int sum, int x) {
  f[sum ^ (1 << w[u])] += x;
  int i;
  for (i = h[u]; i != -1; i = ne[i]) {
    int j = e[i];
    if (j == fa || st[j]) continue;
    build(j, u, sum ^ (1 << w[u]), x);
  }
}
long long getans(int u, int fa, int sum) {
  long long tmp = 0;
  tmp += f[sum ^ (1 << w[u])];
  for (int i = 0; i <= 19; i++) {
    tmp += f[sum ^ (1 << w[u]) ^ (1 << i)];
  }
  for (int i = h[u]; i != -1; i = ne[i]) {
    int j = e[i];
    if (j == fa || st[j]) continue;
    tmp += getans(j, u, sum ^ (1 << w[u]));
  }
  ans[u] += tmp;
  return tmp;
}
void cal(int u) {
  build(u, 0, 0, 1);
  long long tmp = 0;
  tmp += f[0];
  for (int i = 0; i <= 19; i++) {
    tmp += f[1 << i];
  }
  for (int i = h[u]; i != -1; i = ne[i]) {
    int j = e[i];
    if (st[j]) continue;
    build(j, u, 1 << w[u], -1);
    tmp += getans(j, u, 0);
    build(j, u, 1 << w[u], 1);
  }
  ans[u] += tmp / 2;
  build(u, 0, 0, -1);
}
void work(int u, int tot) {
  dfs_rt(u, -1, tot);
  u = rt;
  dfs_sz(u, -1);
  st[u] = 1;
  cal(u);
  for (int i = h[u]; i != -1; i = ne[i]) {
    int j = e[i];
    if (st[j]) continue;
    work(j, sz[j]);
  }
}
int main() {
  ios::sync_with_stdio(false);
  memset(h, -1, sizeof h);
  int n;
  cin >> n;
  int i;
  for (i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    add(a, b);
    add(b, a);
  }
  for (i = 1; i <= n; i++) {
    char c;
    cin >> c;
    w[i] = c - 'a';
  }
  work(1, n);
  for (i = 1; i <= n; i++) {
    cout << ans[i] + 1 << " ";
  }
  cout << endl;
  return 0;
}
