#include <bits/stdc++.h>
using namespace std;
void desperate_optimization(int precision) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
  cout.precision(precision);
}
const int N = 2e5;
const int M = 18;
pair<long long, long long> sparse[M + 1][N + 5];
vector<pair<int, int> > vec[N + 5];
long long a[N + 5];
long long pending[N + 5];
void dfs(int idx) {
  for (int i = 0; i < vec[idx].size(); i++) {
    int nx = vec[idx][i].first;
    long long cost = vec[idx][i].second;
    sparse[0][nx] = {idx, cost};
    dfs(nx);
  }
}
int find(int idx, int m, long long tar) {
  if (m == -1) return idx;
  if (tar >= sparse[m][idx].second)
    return find(sparse[m][idx].first, m - 1, tar - sparse[m][idx].second);
  return find(idx, m - 1, tar);
}
void dfsFinal(int idx) {
  for (int i = 0; i < vec[idx].size(); i++) {
    int nx = vec[idx][i].first;
    dfsFinal(nx);
    pending[idx] += pending[nx];
  }
}
void hora(int tc) {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n; i++) {
    int u, c;
    cin >> u >> c;
    vec[u].push_back({i, c});
  }
  dfs(1);
  sparse[0][1].second = 1e18;
  for (int i = 1; i <= M; i++) {
    for (int j = 1; j <= n; j++) {
      sparse[i][j].first = sparse[i - 1][sparse[i - 1][j].first].first;
      sparse[i][j].second = sparse[i - 1][j].second +
                            sparse[i - 1][sparse[i - 1][j].first].second;
      if (sparse[i][j].first == 0) sparse[i][j].second = 1e18;
    }
  }
  for (int i = 1; i <= n; i++) {
    int idx = find(i, M, a[i]);
    pending[sparse[0][i].first]++;
    pending[sparse[0][idx].first]--;
  }
  dfsFinal(1);
  for (int i = 1; i <= n; i++) cout << pending[i] << " ";
}
int main() {
  desperate_optimization(10);
  int ntc = 1;
  for (int tc = 1; tc <= ntc; tc++) hora(tc);
  return 0;
}
