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

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        new Main().run(in, out);
        out.close();
    }

    public static long mod = 17352642619633L;

    int N;
    long[] a;
    long[] b;
    List<Edge>[] adj;

    void run(FastScanner in, PrintWriter out) {
        N = in.nextInt();
        a = new long[N];
        b = new long[N];
        for (int i = 0; i < N; i++) b[i] = in.nextLong();
        for (int i = 0; i < N; i++) a[i] = in.nextLong();

        adj = new List[N+1];
        int[] deg = new int[N+1];
        for (int i = 0; i < N; i++) adj[i] = new ArrayList<>();
        for (int i = 1; i < N; i++) {
            int u = in.nextInt()-1;
            long k = in.nextLong();
            int v = i;
            adj[u].add(new Edge(v, k));
            deg[v]++;
        }

        int root = 0;
        for (int i = 0; i < N; i++) {
            if (deg[i] == 0) root = i;
        }

        long bal = dfs(root);
        if (bal >= 0) {
            out.println("YES");
        } else {
            out.println("NO");
        }


    }

    long dfs(int u) {

        long bal = b[u];
        for (Edge e : adj[u]) {
            long ret = dfs(e.v);
            if (ret >= 0) bal += ret;
            else bal += e.k * ret;
        }
        bal -= a[u];
        return bal;
    }



    class Edge {
        int v;
        long k;
        Edge(int v, long k) {
            this.v = v;
            this.k = k;
        }
    }


    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}
