#include <bits/stdc++.h>
using namespace std;
const int N = 210000;
int a[N], par[N][20];
long long len[N][20], sum[N], ans[N];
vector<int> ch[N];
void cal(int u) {
  int i;
  for (i = 1; i <= 18; i++) {
    par[u][i] = par[par[u][i - 1]][i - 1];
    len[u][i] = len[u][i - 1] + len[par[u][i - 1]][i - 1];
  }
  for (i = 0; i < ch[u].size(); i++) {
    int v = ch[u][i];
    cal(v);
  }
}
int DFS(int u) {
  int i, s = 0;
  for (i = 0; i < ch[u].size(); i++) {
    int v = ch[u][i];
    s += DFS(v);
  }
  s += sum[u];
  return ans[u] = s;
}
int main() {
  int i, j, n;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  par[0][0] = len[0][0] = 0;
  for (i = 1; i < n; i++) {
    int p, l;
    scanf("%d %d", &p, &l);
    p--;
    par[i][0] = p;
    len[i][0] = l;
    ch[p].push_back(i);
  }
  cal(0);
  for (int u = 0; u < n; u++) {
    int now = u, lim = a[u];
    for (i = 18; now != 0 && i >= 0; i--)
      if (len[now][i] <= lim) lim -= len[now][i], now = par[now][i];
    if (u != 0) sum[par[u][0]]++;
    if (now != 0) sum[par[now][0]]--;
  }
  DFS(0);
  for (i = 0; i < n; i++) printf("%d ", ans[i]);
  puts("");
}
