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.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.Scanner;



public class Main {
	static class Node{
		Node(int _to,int _v){
			to = _to;
			v = BigInteger.valueOf(_v);
			
		}
		int to;
		BigInteger v;
	}

	static class Pair{
		BigInteger val;
		boolean b;
		Pair(BigInteger _a,boolean _b){
			val=_a;
			b=_b;
		}
	}
	static int n;
	static long[] a = new long[100010];
	static long[] b = new long[100010];
	
	static ArrayList<Node>[]  V = new ArrayList[100010];
	
	static Pair dfs(int p,BigInteger v) {
		BigInteger val = BigInteger.valueOf(b[p] - a[p]);
		for (Node son : V[p]){
			Pair ret = dfs(son.to, son.v);
			if (ret.b){
				val = val.add(ret.val);
			}
			else{
				val = val.subtract(ret.val);
			}
		}

		if (val.compareTo(BigInteger.ZERO) >= 0){
			return new Pair(val,true);
		}
		else{
			return new Pair(val.negate().multiply(v),false);
		}
	}
	
	
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		 
		try {
		//	Scanner in = new Scanner(new File("C:\\input.txt"));  
			  Scanner in = new Scanner(System.in);
			
			n = ni();
			for(int i=1;i<=n;++i)
				b[i] = nl();
			for(int i=1;i<=n;++i)
				a[i] = nl();
			for(int i=1;i<=n;++i)
				V[i] = new ArrayList();
			for(int i=2;i<=n;++i) {
				int x = ni();
				int k = ni();
				
				V[x].add(new Node(i,k));
			}
			
			
			Pair ans = dfs(1,BigInteger.ONE);
			if(ans.b) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}
			
			
			
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	     
		
		
		
		
		
		
	}
	
	static private byte[] inbuf = new byte[1024];
	static public int lenbuf = 0, ptrbuf = 0;
	static String INPUT = "";
	static InputStream is= new ByteArrayInputStream(INPUT.getBytes());
	
	static private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	static private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	static private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

}


