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>
namespace Myns {
namespace iostream_ {
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::ios;
}  // namespace iostream_
namespace iomanip_ {
using std::fixed;
using std::setprecision;
}  // namespace iomanip_
namespace string_ {
using std::getline;
using std::string;
}  // namespace string_
namespace algorithm_ {
using std::fill;
using std::max;
using std::max_element;
using std::min;
using std::min_element;
using std::nth_element;
using std::sort;
using std::stable_sort;
}  // namespace algorithm_
namespace utility_ {
using std::make_pair;
using std::pair;
using std::swap;
}  // namespace utility_
namespace array_ {
using std::array;
}
namespace vector_ {
using std::vector;
}
namespace list_ {
using std::list;
}
namespace forward_list_ {
using std::forward_list;
}
namespace deque_ {
using std::deque;
}
namespace stack_ {
using std::stack;
}
namespace queue_ {
using std::priority_queue;
using std::queue;
}  // namespace queue_
namespace set_ {
using std::multiset;
using std::set;
}  // namespace set_
namespace unordered_set_ {
using std::unordered_multiset;
using std::unordered_set;
}  // namespace unordered_set_
namespace map_ {
using std::map;
using std::multimap;
}  // namespace map_
namespace unordered_map_ {
using std::unordered_map;
using std::unordered_multimap;
}  // namespace unordered_map_
namespace iterator_ {
using std::advance;
}
namespace IO {
using namespace iostream_;
using namespace iomanip_;
using namespace string_;
}  // namespace IO
namespace Containers {
using namespace array_;
using namespace vector_;
using namespace list_;
using namespace forward_list_;
using namespace deque_;
using namespace stack_;
using namespace queue_;
using namespace set_;
using namespace unordered_set_;
using namespace map_;
using namespace unordered_map_;
}  // namespace Containers
namespace Utilities {
using namespace utility_;
using namespace algorithm_;
using namespace iterator_;
}  // namespace Utilities
using namespace IO;
using namespace Containers;
using namespace Utilities;
}  // namespace Myns
using namespace Myns;
constexpr int MAX_N = 100009;
constexpr int64_t NINF = -100000000000000000LL;
int n;
int a[MAX_N], b[MAX_N];
vector<pair<int, int64_t>> edge[MAX_N];
int64_t dfs(int k) {
  int64_t result = b[k] - a[k];
  for (auto &e : edge[k]) {
    int64_t balance = dfs(e.first);
    if (balance <= NINF) return NINF;
    if (balance >= 0) {
      result += balance;
    } else {
      if (balance * e.second >= 0) return NINF;
      result += balance * e.second;
    }
    if (result <= NINF) return NINF;
  }
  return result;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> 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 x;
    int64_t k;
    cin >> x >> k;
    edge[x].emplace_back(i, k);
  }
  cout << (dfs(1) >= 0 ? "YES" : "NO") << endl;
}
