#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g;
string s;
vector<int> sz, cnt(1 << 20, 0);
vector<long long> val, ans;
vector<bool> used;
int size_dfs(int vr, int p) {
  sz[vr] = 1;
  for (int u : g[vr])
    if (u != p && !used[u]) sz[vr] += size_dfs(u, vr);
  return sz[vr];
}
int find_centroid(int vr, int p, int my_size) {
  for (int u : g[vr])
    if (u != p && !used[u] && my_size < sz[u] * 2)
      return find_centroid(u, vr, my_size);
  return vr;
}
void count_paths(int vr, int p, int path_value, bool increase) {
  path_value ^= (1 << s[vr]);
  if (increase)
    cnt[path_value]++;
  else
    cnt[path_value]--;
  for (int u : g[vr])
    if (u != p && !used[u]) count_paths(u, vr, path_value, increase);
}
void count_values(int vr, int p, int path, long long& add) {
  path ^= (1 << s[vr]);
  val[vr] = cnt[path];
  int one = -1;
  for (int i = 0; i < 20; i++) {
    val[vr] += cnt[path ^ (1 << i)];
    if (path & (1 << i)) one = i;
  }
  if (one == -1 || !(path ^ (1 << one))) add++;
  for (int u : g[vr]) {
    if (u != p && !used[u]) {
      count_values(u, vr, path, add);
      val[vr] += val[u];
    }
  }
  ans[vr] += val[vr];
}
void solve(int vr) {
  size_dfs(vr, -1);
  vr = find_centroid(vr, -1, sz[vr]);
  used[vr] = true;
  cnt[0]++;
  for (int u : g[vr]) {
    if (!used[u]) count_paths(u, vr, 0, true);
  }
  long long add = 2;
  for (int u : g[vr]) {
    if (!used[u]) {
      count_paths(u, vr, 0, false);
      count_values(u, vr, 1 << s[vr], add);
      count_paths(u, vr, 0, true);
      add += val[u];
    }
  }
  ans[vr] += add / 2;
  cnt[0]--;
  for (int u : g[vr]) {
    if (!used[u]) count_paths(u, vr, 0, false);
  }
  for (int u : g[vr]) {
    if (!used[u]) solve(u);
  }
}
int main() {
  int n;
  cin >> n;
  g.resize(n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  cin >> s;
  for (int i = 0; i < n; i++) s[i] -= 'a';
  ans.resize(n, 0);
  val.resize(n, 0);
  sz.resize(n, 0);
  used.resize(n, 0);
  solve(0);
  for (int i = 0; i < n; i++) cout << ans[i] << ' ';
  cout << endl;
  return 0;
}
