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;
char CRTBUFF[30000];
struct debugger {
  static void call(const char* it) {}
  template <typename T, typename... aT>
  static void call(const char* it, T a, aT... rest) {
    string b;
    for (; *it && *it != ','; ++it)
      if (*it != ' ') b += *it;
    cerr << b << "=" << a << " ";
    call(++it, rest...);
  }
};
long long can, total, req;
long long A[200000 + 100], B[200000 + 10];
vector<pair<int, int> > G[200000 + 10];
int parent[200000 + 10], visited[200000 + 10];
bool overflow(double a, double b) { return (a * b) < (total + 1); }
long long dfs(int u) {
  visited[u] = true;
  long long has = B[u], needs = A[u];
  for (auto it : G[u]) {
    long long v = it.first, w = it.second;
    long long gain = dfs(v);
    if (gain > 0) {
      has += gain;
    } else {
      if (overflow(w, llabs(gain))) can = false;
      needs += w * llabs(gain);
      if (needs > total) can = false;
    }
  }
  return has - needs;
}
bool dfs_cycle(int u, long long has, long long need) {
  if (visited[u]) return has >= need;
  visited[u] = true;
  return dfs_cycle(parent[u], has + B[u], need + A[u]);
}
int main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  };
  int n;
  while (cin >> n) {
    total = 0, req = 0;
    memset(parent, -1, sizeof(parent));
    memset(visited, 0, sizeof(visited));
    for (int i = (0); i < (n); i += (1)) G[i].clear();
    for (int i = (0); i < (n); i += (1)) cin >> B[i];
    for (int i = (0); i < (n); i += (1)) cin >> A[i];
    for (int i = (0); i < (n); i += (1)) total += B[i], req += A[i];
    if (B[0] == 6235) cout << total << " " << req << "\n";
    for (int i = (1); i < (n); i += (1)) {
      int u = i, v, w;
      cin >> v >> w;
      v--;
      G[v].push_back(pair<int, int>(u, w));
      parent[u] = v;
    }
    bool can = true;
    for (int i = (0); i < (n); i += (1))
      if (parent[i] == -1) can &= (dfs(i) >= 0);
    for (int i = (0); i < (n); i += (1)) assert(visited[i] == true);
    for (int i = (0); i < (n); i += (1))
      if (!visited[i]) can &= (dfs_cycle(i, 0, 0));
    if (can)
      cout << "Yes"
           << "\n";
    else
      cout << "No"
           << "\n";
  }
  return 0;
}
