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.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ChemistryInBerland solver = new ChemistryInBerland();
        solver.solve(1, in, out);
        out.close();
    }

    static class ChemistryInBerland {
        ArrayList<Integer>[] tree = new ArrayList[(int) (1e5)];
        long[] mult = new long[(int) (1e5)];
        long[] need = new long[(int) (1e5)];

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
//        N = 100000;
            long[] b = new long[N];
            long[] a = new long[N];
            for (int i = 0; i < N; i++) {
                b[i] = in.nextLong();
//            b[i] = (long)(Math.random() * 1e12);
            }
            for (int i = 0; i < N; i++) {
                a[i] = in.nextLong();
//            a[i] = (long)(Math.random() * 1e12);
                need[i] = b[i] - a[i];
            }
            for (int i = 0; i < N - 1; i++) {
                int x = in.nextInt() - 1;
//            int x = (int)(Math.random() * i);
                long k = in.nextLong();
//            long k = (long)(Math.random() * 1e9);
                mult[i + 1] = k;
                tree[i] = new ArrayList<>();
                tree[x].add(i + 1);
            }
            tree[N - 1] = new ArrayList<>();
            if (dfs(0) >= 0) {
                out.println("YES");
            } else {
                out.println("NO");
            }
        }

        long dfs(int n) {
            long have = need[n];
            for (int e : tree[n]) {
                long a = dfs(e);
                if (a >= 0) {
                    have += a;
                } else {
                    if (mult[e] > (long) (1e17) / Math.abs(a)) {
                        have = -(long) (1e17);
                    } else {
                        have += a * mult[e];
                    }
                }
                have = Math.min(have, (long) (1e17));
                have = Math.max(-(long) (1e17), have);
            }
            return have;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

    }
}

