#include <bits/stdc++.h>
using namespace std;
const int L = 20;
int go(int loc, vector<vector<int> > &chi, vector<int> &vals,
       vector<int> &ans) {
  int res = 0;
  for (int ch : chi[loc]) res += go(ch, chi, vals, ans);
  ans[loc] = res;
  return res + vals[loc];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  vector<vector<int> > chi(N);
  vector<vector<int> > par(L, vector<int>(N));
  vector<vector<long long> > dist(L, vector<long long>(N));
  for (int i = 1; i < N; i++) {
    cin >> par[0][i] >> dist[0][i];
    par[0][i]--;
    chi[par[0][i]].push_back(i);
  }
  for (int l = 1; l < L; l++) {
    for (int i = 1; i < N; i++) {
      par[l][i] = par[l - 1][par[l - 1][i]];
      dist[l][i] = dist[l - 1][i] + dist[l - 1][par[l - 1][i]];
    }
  }
  vector<int> vals(N);
  for (int i = 0; i < N; i++) {
    int len = a[i];
    int loc = i;
    for (int l = L - 1; l >= 0; l--) {
      if (dist[l][loc] <= len) {
        len -= dist[l][loc];
        loc = par[l][loc];
      }
    }
    vals[i]++;
    vals[loc]--;
  }
  vector<int> ans(N);
  go(0, chi, vals, ans);
  for (int v : ans) cout << v << " ";
  cout << endl;
  return 0;
}
