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

public class E {


	static int N;
	static ArrayList<Integer>[] adjList;
	static long[] X;
	static long[] Ans;
	static long[] A, B;

	static long dfs1(int u, int p) {
		long cur = A[u];

		for(int v : adjList[u])
			if(v != p) 
				cur += dfs1(v, u);
		Ans[u] = Math.min(cur, B[u]);
		return Math.max(0, cur - B[u]);
	}

	static long dfs2(int u, int p, long over) {
		if(over + Ans[u] < B[u])
			return 0;

		long extra = over + Ans[u] - B[u];
		Ans[u] = B[u];

		for(int v : adjList[u]){
			if(v != p) {
				long stay = extra % X[v];
				extra = dfs2(v, u, extra / X[v]) * X[v] + stay;
			}
		}

		return extra;
	}


	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		N = sc.nextInt();
		adjList = new ArrayList[N];
		for (int i = 0; i < N; i++) 
			adjList[i] = new ArrayList<>();

		A = new long[N];
		B = new long[N];
		Ans = new long[N];
		X = new long[N];
		for (int i = 0; i < N; i++)
			A[i] = sc.nextLong();
		for (int i = 0; i < N; i++)
			B[i] = sc.nextLong();

		for (int i = 0; i < N - 1; i++) {
			adjList[sc.nextInt() - 1].add(i + 1);
			X[i + 1] = sc.nextLong();
		}
		long v = dfs1(0, -1);
		Ans[0] += v;
		dfs2(0, -1, 0);

		boolean f = true;
		for (int i = 0; i < N; i++) {
			if(Ans[i] < B[i])
				f = false;
		}

		out.println(f ? "YES" : "NO");

		out.flush();
		out.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}
		public Scanner(String file) throws FileNotFoundException{	br = new BufferedReader(new FileReader(file));}
		public String next() throws IOException 
		{
			while (st == null || !st.hasMoreTokens()) 
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public String nextLine() throws IOException {return br.readLine();}


		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

		public boolean ready() throws IOException {return br.ready();}



	}

}