#include <bits/stdc++.h>
using namespace std;
int n;
int a[200010];
int tLca[200010][20];
long long tDist[200010][20];
int d[200010];
int psum[200010];
vector<int> atd[200010];
vector<int> c[200010];
void dfs(int x, int de) {
  d[x] = de;
  for (int j = 1, k = 2; k < d[x]; j++, k *= 2) {
    tLca[x][j] = tLca[tLca[x][j - 1]][j - 1];
    tDist[x][j] = tDist[x][j - 1] + tDist[tLca[x][j - 1]][j - 1];
  }
  for (auto &i : c[x]) {
    dfs(i, de + 1);
  }
}
int32_t main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  tLca[0][0] = 200000;
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    tDist[i][0] = b;
    tLca[i][0] = a;
    c[a].push_back(i);
  }
  dfs(0, 1);
  for (int i = 0; i < n; i++) {
    long long totald = 0;
    int cur = i;
    for (int j = 19; j >= 0; j--) {
      if ((1 << j) >= d[cur]) {
        continue;
      }
      if (totald + tDist[cur][j] <= a[i]) {
        totald += tDist[cur][j];
        cur = tLca[cur][j];
      }
    }
    psum[tLca[i][0]]++;
    psum[tLca[cur][0]]--;
  }
  for (int i = 0; i < n; i++) {
    atd[d[i]].push_back(i);
  }
  for (int i = n; i >= 0; i--) {
    for (auto &j : atd[i]) {
      psum[tLca[j][0]] += psum[j];
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", psum[i]);
  }
  return 0;
}
