5
27468 7465 74275 40573 40155
112071 76270 244461 264202 132397
1 777133331
2 107454154
3 652330694
4 792720519
 5
78188 56310 79021 70050 65217
115040 5149 128449 98357 36580
1 451393770
2 574046602
3 590130784
4 112514248
 7
1 1 1 1 1 1 1
1 3000000000 3000000000 3000000000 1000000000 1000000000 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
 10
2 8 6 1 2 7 6 9 2 8
4 9 4 3 5 2 9 3 7 3
1 8
2 8
3 8
4 10
5 1
6 4
7 3
8 10
9 2
 11
1 1 1 1 1 1 1 1 1 1 1
1 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
 5
2 1 1 2 3
1 2 2 2 1
1 2
1 3
2 4
1 4

NO
 NO
 NO
 YES
 NO
 NO

#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
struct vertex {
  int v;
  long long c1, c2;
};
int n;
bool answer, can;
double CONSTANT = ((MOD - 7) * 1ll * 1e4) + 0.0;
long long a[100100], b[100100];
vector<vector<vertex> > g(1);
void dfs(int v, int p, long long c1, long long c2) {
  if (!answer) return;
  for (int i = 0; i < g[v].size(); i++) {
    if (g[v][i].v == p) continue;
    dfs(g[v][i].v, v, g[v][i].c1, g[v][i].c2);
    if (!answer) return;
  }
  if (g[v].size() == 1) can = true;
  if (v == 0 && can) return;
  if (can) {
    long long ss = b[v];
    if (ss == a[v]) return;
    if (ss < a[v]) {
      long long q = a[v] - ss;
      b[v] = a[v];
      double h1 = q / CONSTANT;
      h1 = h1 * (double)c1;
      if (a[p] < 0)
        h1 = h1 + (fabs(a[p]) / CONSTANT);
      else
        h1 = h1 - (a[p] / CONSTANT);
      if (h1 > 2e3) answer = false;
      if (!answer) return;
      a[p] -= q * 1ll * c1;
    } else {
      long long q = ss - a[v];
      b[v] = a[v];
      double h1 = q / CONSTANT;
      h1 = h1 * (double)c2;
      if (a[p] < 0)
        h1 = h1 - (fabs(a[p]) / CONSTANT);
      else
        h1 = h1 + (a[p] / CONSTANT);
      if (h1 > 2e3) answer = false;
      if (!answer) return;
      a[p] += q * 1ll * c2;
    }
  }
  if (!answer) return;
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  g.resize(n);
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n - 1; i++) {
    int x;
    long long k;
    cin >> x >> k;
    x--;
    g[x].push_back({i + 1, k, 1ll});
    g[i + 1].push_back({x, 1ll, k});
  }
  answer = true;
  can = false;
  dfs(0, -1, -1ll, -1ll);
  if (!answer) {
    cout << "NO";
    return 0;
  }
  if (b[0] >= a[0])
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
