#include <bits/stdc++.h>
using namespace std;
const int N = 200005, M = 20;
long long dist[M][N], par[M][N], n;
long long ar[N], dp[N];
vector<int> g[N];
void dfs(int cur, int prev) {
  for (auto v : g[cur]) {
    if (v == prev) continue;
    dfs(v, cur);
    dp[cur] += dp[v];
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> ar[i];
  for (int i = 2; i <= n; i++) {
    cin >> par[0][i] >> dist[0][i];
    g[par[0][i]].push_back(i);
  }
  for (int i = 1; i < M; i++) {
    for (int j = 1; j < N; j++) {
      par[i][j] = par[i - 1][par[i - 1][j]];
      dist[i][j] = dist[i - 1][j] + dist[i - 1][par[i - 1][j]];
    }
  }
  for (int i = 1; i <= n; i++) {
    long long cd = ar[i];
    long long cn = i;
    for (int i = 19; i >= 0; i--) {
      if (cd - dist[i][cn] >= 0) {
        cd -= dist[i][cn];
        cn = par[i][cn];
      }
    }
    dp[par[0][cn]]--;
    dp[par[0][i]]++;
  }
  dfs(1, 0);
  for (int i = 1; i <= n; i++) cout << dp[i] << ' ';
  cout << '\n';
  return 0;
}
