#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 5;
vector<long long> e[maxn], blok(maxn), d(maxn), a(maxn);
vector<long long> sol(maxn);
void depth(long long x, long long st) {
  d[x] = 1;
  for (auto& i : e[x]) {
    if (i == st || blok[i]) continue;
    depth(i, x);
    d[x] += d[i];
  }
}
long long c;
void centroid(long long x, long long st, long long k) {
  bool ok = 1;
  for (auto& i : e[x]) {
    if (blok[i] || st == i) continue;
    if (2 * d[i] > k) ok = 0;
    centroid(i, x, k);
  }
  if (2 * (k - d[x]) > k) ok = 0;
  if (ok) c = x;
}
const long long maxx = (1 << 20) + 5;
long long cnt[maxx];
long long dfs(long long x, long long st, long long cur = 0) {
  cur ^= a[x];
  if (x != st) ++cnt[cur];
  long long cc = (__builtin_popcount(cur) <= 1);
  for (auto& i : e[x]) {
    if (i == st || blok[i]) continue;
    cc += dfs(i, x, cur);
  }
  sol[x] += cc;
  return cc;
}
void korekt(long long x, long long st, long long z, long long cur) {
  cur ^= a[x];
  cnt[cur] += z;
  for (auto& i : e[x]) {
    if (!blok[i] && st != i) korekt(i, x, z, cur);
  }
}
long long calc(long long x, long long st, long long cur) {
  cur ^= a[x];
  long long k = cur ^ a[c], cc = cnt[k];
  for (long long j = 0; j < 20; ++j) {
    long long y = (1 << j) ^ k;
    if (y != k) cc += cnt[y];
  }
  for (auto& i : e[x]) {
    if (i != st && !blok[i]) {
      long long y = calc(i, x, cur);
      cc += y;
    }
  }
  sol[x] += cc;
  return cc;
}
void solve(long long x) {
  depth(x, x);
  centroid(x, x, d[x]);
  blok[c] = 1;
  dfs(c, c);
  long long y = 0;
  for (auto& i : e[c]) {
    if (blok[i]) continue;
    korekt(i, i, -1, a[c]);
    y += calc(i, i, a[c]);
    korekt(i, i, 1, a[c]);
  }
  for (auto& i : e[c]) {
    if (!blok[i]) korekt(i, i, -1, a[c]);
  }
  sol[c] += y / 2;
  for (auto& i : e[c]) {
    if (!blok[i]) solve(i);
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  long long n;
  cin >> n;
  for (long long i = 1; i < n; ++i) {
    long long u, v;
    cin >> u >> v;
    e[u].push_back(v);
    e[v].push_back(u);
  }
  for (long long i = 1; i <= n; ++i) {
    char ch;
    cin >> ch;
    a[i] = (1 << (ch - 'a'));
  }
  solve(1);
  for (long long i = 1; i <= n; ++i) cout << sol[i] << ' ';
  cout << '\n';
}
