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

public class e {
	public static void main(String[] args) throws IOException {
		FastScanner in = new FastScanner(System.in);
		int n = in.nextInt();
		long[] bs = new long[n];
		long[] as = new long[n];
		for (int i = 0; i < n; i++) {
			bs[i] = in.nextLong();
		}
		for (int i = 0; i < n; i++) {
			as[i] = in.nextLong();
		}
		ArrayList<Edge>[] cs = new ArrayList[n];
		int[] par = new int[n];
		for (int i = 0; i < n; i++)
			cs[i] = new ArrayList<>();
		int[] degs = new int[n];
		for (int i = 1; i < n; i++) {
			int x = in.nextInt() - 1, k = in.nextInt();
			cs[x].add(new Edge(i, k));
			par[i] = x;
			degs[x]++;
		}
		ArrayDeque<Integer> q = new ArrayDeque<Integer>();
		for (int i = 0; i < n; i++) {
			if (degs[i] == 0) {
				q.offer(i);
			}
		}
		long[] demands = new long[n];
		try {
			while (!q.isEmpty()) {
				int v = q.poll();
				long demand = bs[v] - as[v];
	//			System.out.println(v + ": " + demand);
				for (Edge e : cs[v]) {
					if (demands[e.v] < 0) {
						demand = Math.addExact(demand, Math.multiplyExact(demands[e.v], e.w));
					} else {
						demand = Math.addExact(demand, demands[e.v]);
					}
				}
				if (v != 0) {
					degs[par[v]]--;
					if (degs[par[v]] == 0)
						q.offer(par[v]);
				}
				demands[v] = demand;
			}
		} catch(Exception e) {
			System.out.println("NO");
			return;
		}
		System.out.println(demands[0] >= 0 ? "YES" : "NO");
	}

	static class Edge {
		int v;
		int w;

		public Edge(int v, int w) {
			this.v = v;
			this.w = w;
		}
	}
	static class FastScanner {
	    BufferedReader br;
	    StringTokenizer st;
		
	    public FastScanner(InputStream i) {
	        br = new BufferedReader(new InputStreamReader(i));
	        st = new StringTokenizer("");
	    }
				
	    public String next() throws IOException {
	        if(st.hasMoreTokens())
	            return st.nextToken();
	        else
	            st = new StringTokenizer(br.readLine());
	        return next();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    //#
	    public long nextLong() throws IOException {
	        return Long.parseLong(next());
	    }
	    public double nextDouble() throws IOException {
	        return Double.parseDouble(next());
	    }
	    //$
	}
}
