#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 200010;
long long pw(long long b, long long r, long long md) {
  long long ans = 1;
  while (r) {
    if (r & 1) ans = (ans * b) % md;
    b = (b * b) % md;
    r >>= 1;
  }
  return ans;
}
vector<long long> adj[MAXN];
long long pref[MAXN];
long long dp[MAXN][30], dp2[MAXN][30];
long long arr[MAXN], n;
void dfs(long long u) {
  for (auto v : adj[u]) {
    dfs(v);
    pref[u] += pref[v];
  }
}
void form() {
  for (int i = 1; i <= 29; i++) {
    for (int j = 1; j <= n; j++) {
      dp[j][i] = dp[dp[j][i - 1]][i - 1];
      dp2[j][i] = dp2[j][i - 1] + dp2[dp[j][i - 1]][i - 1];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(dp, 0, sizeof dp);
  memset(dp2, 0, sizeof dp2);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 2; i <= n; i++) {
    cin >> dp[i][0] >> dp2[i][0];
    adj[dp[i][0]].push_back(i);
  }
  form();
  for (int i = 1; i <= n; i++) {
    long long to = i;
    for (int j = 29; j >= 0; j--) {
      if (dp2[to][j] <= arr[i]) {
        arr[i] -= dp2[to][j];
        to = dp[to][j];
      }
    }
    pref[dp[i][0]]++;
    pref[dp[to][0]]--;
  }
  dfs(1);
  for (int i = 1; i <= n; i++) cout << pref[i] << " ";
  cout << '\n';
  return 0;
}
