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;
template <class T>
bool umin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
const int base = 1e9;
void Set(vector<int> &a) {
  while (a.size() > 1 && a.back() == 0) a.pop_back();
}
void Print(vector<int> a) {
  Set(a);
  printf("%d", (a.size() == 0) ? 0 : a.back());
  for (int i = a.size() - 2; i >= 0; i--) printf("%09d", a[i]);
  printf("\n");
}
vector<int> Integer(string s) {
  vector<int> ans;
  if (s[0] == '-') return ans;
  if (s.size() == 0) {
    ans.push_back(0);
    return ans;
  }
  while (s.size() % 9 != 0) s = '0' + s;
  for (int i = 0; i < (int)s.size(); i += 9) {
    int v = 0;
    for (int j = i; j < i + 9; j++) v = v * 10 + (s[j] - '0');
    ans.insert(ans.begin(), v);
  }
  Set(ans);
  return ans;
}
vector<int> Integer(char c[]) {
  string s = "";
  for (int i = 0; i <= strlen(c) - 1; i++) s = s + c[i];
  return Integer(s);
}
vector<int> Integer(long long x) {
  string s = "";
  while (x > 0) s = char(x % 10 + '0') + s, x /= 10;
  return Integer(s);
}
vector<int> Integer(int x) { return Integer((long long)x); }
void operator>>(istream &in, vector<int> &a) {
  string s;
  getline(cin, s);
  a = Integer(s);
}
void operator<<(ostream &out, vector<int> a) { Print(a); }
bool operator<(vector<int> a, vector<int> b) {
  Set(a);
  Set(b);
  if (a.size() != b.size()) return (a.size() < b.size());
  for (int i = a.size() - 1; i >= 0; i--)
    if (a[i] != b[i]) return (a[i] < b[i]);
  return false;
}
bool operator>(vector<int> a, vector<int> b) { return (b < a); }
bool operator==(vector<int> a, vector<int> b) { return (!(a < b) && !(b < a)); }
bool operator<=(vector<int> a, vector<int> b) { return (a < b || a == b); }
bool operator>=(vector<int> a, vector<int> b) { return (b < a || b == a); }
bool operator<(vector<int> a, int b) { return (a < Integer(b)); }
bool operator>(vector<int> a, int b) { return (a > Integer(b)); }
bool operator==(vector<int> a, int b) { return (a == Integer(b)); }
bool operator>=(vector<int> a, int b) { return (a >= Integer(b)); }
bool operator<=(vector<int> a, int b) { return (a <= Integer(b)); }
vector<int> max(vector<int> a, vector<int> b) {
  if (a > b) return a;
  return b;
}
vector<int> min(vector<int> a, vector<int> b) {
  if (a < b) return a;
  return b;
}
vector<int> operator+(vector<int> a, vector<int> b) {
  Set(a);
  Set(b);
  vector<int> ans;
  int carry = 0;
  for (int i = 0; i <= max(a.size(), b.size()) - 1; i++) {
    if (i < a.size()) carry += a[i];
    if (i < b.size()) carry += b[i];
    ans.push_back(carry % base);
    carry /= base;
  }
  if (carry) ans.push_back(carry);
  Set(ans);
  return ans;
}
vector<int> operator+(vector<int> a, int b) { return a + Integer(b); }
vector<int> operator++(vector<int> &a) {
  a = a + 1;
  return a;
}
void operator+=(vector<int> &a, vector<int> b) { a = a + b; }
void operator+=(vector<int> &a, int b) { a = a + b; }
vector<int> operator-(vector<int> a, vector<int> b) {
  Set(a);
  Set(b);
  vector<int> ans;
  int carry = 0;
  for (int i = 0; i <= a.size() - 1; i++) {
    carry += a[i] - (i < b.size() ? b[i] : 0);
    if (carry < 0)
      ans.push_back(carry + base), carry = -1;
    else
      ans.push_back(carry), carry = 0;
  }
  Set(ans);
  return ans;
}
vector<int> operator-(vector<int> a, int b) { return a - Integer(b); }
void operator--(vector<int> &a) { a = a - 1; }
void operator-=(vector<int> &a, vector<int> b) { a = a + b; }
void operator-=(vector<int> &a, int b) { a = a - b; }
vector<int> operator*(vector<int> a, vector<int> b) {
  Set(a);
  Set(b);
  vector<int> ans;
  ans.assign(a.size() + b.size(), 0);
  for (int i = 0; i <= a.size() - 1; i++) {
    long long carry = 0ll;
    for (int j = 0; j < b.size() || carry > 0; j++) {
      long long s = ans[i + j] + carry +
                    (long long)a[i] * (j < b.size() ? (long long)b[j] : 0ll);
      ans[i + j] = s % base;
      carry = s / base;
    }
  }
  Set(ans);
  return ans;
}
vector<int> operator*(vector<int> a, int b) { return a * Integer(b); }
void operator*=(vector<int> &a, vector<int> b) { a = a * b; }
void operator*=(vector<int> &a, int b) { a = a * b; }
vector<int> operator/(vector<int> a, vector<int> b) {
  Set(a);
  Set(b);
  if (b == Integer(0)) return Integer("-1");
  vector<int> ans, cur;
  for (int i = a.size() - 1; i >= 0; i--) {
    cur.insert(cur.begin(), a[i]);
    int x = 0, L = 0, R = base;
    while (L <= R) {
      int mid = (L + R) >> 1;
      if (b * Integer(mid) > cur) {
        x = mid;
        R = mid - 1;
      } else
        L = mid + 1;
    }
    cur = cur - Integer(x - 1) * b;
    ans.insert(ans.begin(), x - 1);
  }
  Set(ans);
  return ans;
}
vector<int> operator/(vector<int> a, int b) {
  Set(a);
  vector<int> ans;
  long long cur = 0ll;
  for (int i = a.size() - 1; i >= 0; i--) {
    cur = (cur * (long long)base + (long long)a[i]);
    ans.insert(ans.begin(), cur / b);
    cur %= b;
  }
  Set(ans);
  return ans;
}
void operator/=(vector<int> &a, vector<int> b) { a = a / b; }
void operator/=(vector<int> &a, int b) { a = a / b; }
vector<int> operator%(vector<int> a, vector<int> b) {
  Set(a);
  Set(b);
  if (b == Integer(0)) return Integer("-1");
  vector<int> ans;
  for (int i = a.size() - 1; i >= 0; i--) {
    ans.insert(ans.begin(), a[i]);
    int x = 0, L = 0, R = base;
    while (L <= R) {
      int mid = (L + R) >> 1;
      if (b * Integer(mid) > ans) {
        x = mid;
        R = mid - 1;
      } else
        L = mid + 1;
    }
    ans = ans - Integer(x - 1) * b;
  }
  Set(ans);
  return ans;
}
int operator%(vector<int> a, int b) {
  Set(a);
  if (b == 0) return -1;
  int ans = 0;
  for (int i = a.size() - 1; i >= 0; i--)
    ans = (ans * (base % b) + a[i] % b) % b;
  return ans;
}
void operator%=(vector<int> &a, vector<int> b) { a = a % b; }
void operator%=(vector<int> &a, int b) { a = a % Integer(b); }
vector<int> gcd(vector<int> a, vector<int> b) {
  Set(a);
  Set(b);
  while (b > Integer(0)) {
    vector<int> r = a % b;
    a = b;
    b = r;
  }
  Set(a);
  return a;
}
vector<int> lcm(vector<int> a, vector<int> b) { return (a * b / gcd(a, b)); }
vector<int> sqrt(vector<int> a) {
  vector<int> x0 = a, x1 = (a + 1) / 2;
  while (x1 < x0) {
    x0 = x1;
    x1 = (x1 + a / x1) / 2;
  }
  return x0;
}
vector<int> pow(vector<int> a, vector<int> b) {
  if (b == Integer(0)) return Integer(1);
  vector<int> tmp = pow(a, b / 2);
  if (b % 2 == 0) return tmp * tmp;
  return tmp * tmp * a;
}
vector<int> pow(vector<int> a, int b) { return pow(a, (Integer(b))); }
int log(int n, vector<int> a) {
  Set(a);
  int ans = 0;
  while (a > Integer(1)) {
    ans++;
    a /= n;
  }
  return ans;
}
vector<int> a[100009], b[100009];
long long arr[100009];
vector<int> adj[100009];
void dfs(int nd) {
  for (int i = 0; i < int(adj[nd].size()); i++) {
    int to = adj[nd][i];
    dfs(to);
    if (b[to] >= a[to])
      b[nd] += b[to] - a[to];
    else
      b[nd] -= (a[to] - b[to]) * 1LL * arr[to];
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n; i++) {
    int p;
    scanf("%d%lld", &p, &arr[i]);
    adj[p].push_back(i);
  }
  dfs(1);
  for (int i = 1; i <= n; i++)
    if (b[i] < a[i]) return puts("NO") * 0;
  puts("YES");
  return 0;
}
