#include <bits/stdc++.h>
using namespace std;
vector<int> G[200005];
int n, a[200005], dad[200005][20], mars[200005], sol[200005];
long long wdad[200005][20];
int DFS(int u) {
  int S = 0;
  for (auto x : G[u]) S += DFS(x);
  sol[u] = S;
  return S + mars[u];
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 2; i <= n; ++i) {
    cin >> dad[i][0] >> wdad[i][0];
    G[dad[i][0]].push_back(i);
  }
  for (int h = 1; h < 20; ++h) {
    for (int i = 1; i <= n; ++i) {
      dad[i][h] = dad[dad[i][h - 1]][h - 1];
      wdad[i][h] = wdad[i][h - 1] + wdad[dad[i][h - 1]][h - 1];
    }
  }
  for (int i = 1; i <= n; ++i) {
    long long w = 0;
    int ans = i;
    for (int j = 20 - 1; j >= 0; --j) {
      if (a[i] >= w + wdad[ans][j]) {
        w += wdad[ans][j];
        ans = dad[ans][j];
      }
    }
    ++mars[i];
    --mars[ans];
  }
  DFS(1);
  for (int i = 1; i <= n; ++i) cout << sol[i] << " ";
  cout << "\n";
  return 0;
}
