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;
vector<vector<pair<int, int>>> graf;
vector<vector<int>> fa;
vector<int> topfa;
vector<long long> l, m;
void bfs(int start, int &ki, int &mxtav) {
  mxtav = 0;
  vector<int> tav(fa.size(), -1);
  vector<bool> b(fa.size(), 0);
  queue<int> q;
  q.push(start);
  b[start] = 1;
  tav[start] = 0;
  ki = start;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    b[x] = 1;
    ki = x;
    for (int i : fa[x]) {
      if (!b[i]) {
        q.push(i);
        tav[i] = tav[x] + 1;
        mxtav = max(mxtav, tav[i]);
      }
    }
  }
}
void bfs2(int start) {
  vector<bool> visit(fa.size(), 0);
  queue<int> q;
  q.push(start);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    visit[x] = 1;
    topfa.push_back(x);
    for (int i : fa[x]) {
      if (!visit[i]) {
        q.push(i);
      }
    }
  }
}
void dfs(int a, int b, vector<bool> &visit, vector<bool> &ez, int &mxtav,
         int &z) {
  visit[a] = 1;
  for (int i : fa[a]) {
    if (!visit[i]) {
      dfs(i, b, visit, ez, mxtav, z);
      if (ez[i] == 1) {
        ez[a] = 1;
        mxtav--;
        if (mxtav == 0) {
          z = a;
          return;
        }
      }
    }
  }
}
void lp(int &kozep) {
  int a, b;
  int mxtav;
  bfs(0, a, mxtav);
  bfs(a, b, mxtav);
  vector<bool> visit(fa.size(), 0), ez(fa.size(), 0);
  ez[b] = 1;
  mxtav = mxtav / 2;
  dfs(a, b, visit, ez, mxtav, kozep);
}
void topologikus() {
  int start;
  lp(start);
  bfs2(start);
}
void kivonulas() {
  int n = fa.size();
  vector<bool> visit(n, 0);
  for (int i = n - 1; i >= 1; i--) {
    int hol = topfa[i];
    visit[hol] = 1;
    int hova;
    for (int j : fa[hol]) {
      if (visit[j] == 0) {
        hova = j;
        break;
      }
    }
    long long ki, be;
    for (auto j : graf[hol]) {
      if (j.first == hova) {
        ki = j.second;
      }
    }
    for (auto j : graf[hova]) {
      if (j.first == hol) {
        be = j.second;
      }
    }
    if (m[hol] > 0) {
      m[hova] += m[hol] / ki;
      m[hol] = 0;
    } else {
      m[hova] += be * m[hol];
      m[hol] = 0;
    }
  }
}
int main() {
  int n;
  cin >> n;
  fa.resize(n);
  graf.resize(n);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    l.push_back(x);
  }
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    l[i] -= x;
    m.push_back(l[i]);
  }
  for (int i = 0; i < n - 1; i++) {
    long long x, k;
    cin >> x >> k;
    x--;
    graf[x].push_back(make_pair(i + 1, k));
    graf[i + 1].push_back(make_pair(x, 1));
    fa[x].push_back(i + 1);
    fa[i + 1].push_back(x);
  }
  topologikus();
  kivonulas();
  long long szum = 0;
  for (int i : m) {
    szum += i;
  }
  if (szum < 0) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
  return 0;
}
