#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int dp[19][N], fa[N], tmp[N], l, r, q[N], n, tag[N];
long long a[N], w[N], val[N];
vector<int> v[N];
void dfs(int p) {
  for (int i = 0; i < v[p].size(); i++) {
    int to = v[p][i];
    val[to] = val[p] + w[to];
    dfs(to);
  }
  int now = p;
  for (int i = 17; i >= 0; i--) {
    if (dp[i][p] == -1) continue;
    if (val[p] - a[p] <= val[dp[i][now]]) now = dp[i][now];
  }
  now = fa[now];
  p = fa[p];
  if (p != -1) tmp[p]++;
  if (now != -1) tmp[now]--;
}
int main() {
  memset(fa, -1, sizeof(fa));
  memset(dp, -1, sizeof(dp));
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 2; i <= n; i++)
    scanf("%d%d", fa + i, w + i), v[fa[i]].push_back(i), tag[fa[i]]++;
  for (int i = 2; i <= n; i++)
    if (!tag[i]) q[r++] = i;
  for (int i = 2; i <= n; i++) dp[0][i] = fa[i];
  for (int i = 1; i < 18; i++)
    for (int j = 1; j <= n; j++)
      if (dp[i - 1][j] != -1) dp[i][j] = dp[i - 1][dp[i - 1][j]];
  dfs(1);
  while (l < r) {
    int p = q[l++];
    if (p == 1) break;
    tmp[fa[p]] += tmp[p];
    tag[fa[p]]--;
    if (!tag[fa[p]]) q[r++] = fa[p];
  }
  for (int i = 1; i <= n; i++) printf("%d%c", tmp[i], i == n ? '\n' : ' ');
  return 0;
}
