#include <bits/stdc++.h>
using namespace std;
long long n, a[200002], ans[200002], dp[20][200002], dist[200002];
vector<pair<long long, long long> > G[200002];
long long hatz(long long x, long long y) { return abs(dist[x] - dist[y]); }
void dfs(long long x, long long d) {
  dist[x] = d;
  for (long long i = 1; i < 20; i++) dp[i][x] = dp[i - 1][dp[i - 1][x]];
  long long y = x;
  for (long long i = 19; i >= 0; i--)
    if (hatz(dp[i][y], y) <= a[x]) {
      a[x] -= hatz(dp[i][y], y);
      y = dp[i][y];
    }
  ans[dp[0][x]]++;
  ans[dp[0][y]]--;
  for (auto it : G[x]) {
    dfs(it.first, d + it.second);
    ans[x] += ans[it.first];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 2; i <= n; i++) {
    long long x, y;
    cin >> x >> y;
    G[x].push_back({i, y});
    dp[0][i] = x;
  }
  dfs(1, 0);
  for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
