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;
long long inline gcd(long long x, long long y) {
  return !y ? (long long)abs(x) : gcd(y, x % y);
}
long long inline lcm(long long a, long long b) {
  return ((long long)abs((a / gcd(a, b)) * b));
}
double inline cartesian_dist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
long long bigmod(long long b, long long p, long long m) {
  if (!p)
    return 1 % m;
  else if (p & 1)
    return (((b % m) + m) % m * bigmod(b, p - 1, m)) % m;
  else {
    long long ret = bigmod(b, p / 2, m);
    return (ret * ret) % m;
  }
}
long long inverse(long long a, long long m) { return bigmod(a, m - 2, m); }
long long extended(long long a, long long m) {
  long long oldr = a, r = m, oldans = 1, ans = 0, quotient;
  while (r) {
    quotient = oldr / r;
    oldr = oldr - r * quotient;
    swap(oldr, r);
    oldans = oldans - ans * quotient;
    swap(oldans, ans);
  }
  return ((oldans % m) + m) % m;
}
const double PI = acos(-1.0);
const double eps = 10E-12;
long long MOD = 101LL;
int n;
long long have[(int)1e5 + 5], need[(int)1e5 + 5];
vector<pair<int, pair<int, int> > > vec[(int)1e5 + 5];
bool flag = true;
long long solve(int u, int par, long long wF, long long wR) {
  long long ret = (have[u] - need[u]);
  for (int i = 0; i < vec[u].size(); i++) {
    long long v = vec[u][i].first;
    if (v != par)
      ret += solve(v, u, (long long)vec[u][i].second.first,
                   (long long)vec[u][i].second.second);
  }
  if (ret < 0) {
    long long maxVal =
        (long long)ceil((double)(long long)1e18 / (double(-ret)));
    if (wF <= maxVal) {
      if (wF * ret < -(long long)1e17) flag = false;
      ;
    } else
      flag = false;
    return ret * wF;
  }
  return ret / wR;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &have[i]);
  for (int i = 1; i <= n; i++) scanf("%lld", &need[i]);
  for (int i = 2, x, k; i <= n; i++) {
    scanf("%d %d", &x, &k);
    vec[i].push_back(make_pair(x, make_pair(1, k)));
    vec[x].push_back(make_pair(i, make_pair(k, 1)));
  }
  if (solve(1, -1, 1LL, 1LL) >= 0LL && flag) {
    printf("YES\n");
    return 0;
  }
  printf("NO\n");
  return 0;
}
