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.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Edu28_E {

	static long[] sup;

	static int[] sConv;
	static int[] rev;

	static ArrayList<Integer>[] rList;

	static PrintWriter printer;

	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		int nV = Integer.parseInt(reader.readLine());
		sup = new long[nV];
		StringTokenizer inputData = new StringTokenizer(reader.readLine());
		for (int i = 0; i < nV; i++) {
			sup[i] = Long.parseLong(inputData.nextToken());
		}
		inputData = new StringTokenizer(reader.readLine());
		for (int i = 0; i < nV; i++) {
			sup[i] -= Long.parseLong(inputData.nextToken());
		}

		sConv = new int[nV];
		rev = new int[nV];

		ArrayList<int[]> trans = new ArrayList<>();

		for (int i = 1; i < nV; i++) {
			inputData = new StringTokenizer(reader.readLine());
			int type = Integer.parseInt(inputData.nextToken()) - 1;
			int amt = Integer.parseInt(inputData.nextToken());
			sConv[i] = type;
			trans.add(new int[] { type, amt, i });
		}

		cInd = new int[nV];
		for (int i = 0; i < nV; i++) {
			cInd[i] = i;
		}
		lVisit = new int[nV];
		Arrays.fill(lVisit, -1);

		int cN = 0;
		for (int i = 0; i < nV; i++) {
			if (lVisit[i] == -1) {
				cPath.clear();
				search(i, cN++);
			}
		}

		for (int i = 0; i < nV; i++) {
			sConv[i] = sConv[cInd[i]];
		}

		rList = new ArrayList[nV];
		for (int i = 0; i < nV; i++) {
			rList[i] = new ArrayList<Integer>();
		}

		for (int[] cTran : trans) {
			int indM = cInd[cTran[0]];
			int indS = cInd[cTran[2]];
			if (indM != indS) {
				rev[indS] = cTran[1];
				rList[indM].add(indS);
			}
		}

		visited = new boolean[nV];
		for (int i = 0; i < nV; i++) {
			if (!visited[i]) {
				dfs(i);
			}
		}

		for (int i = 0; i < nV; i++) {
			if (sup[i] < 0) {
				printer.println("NO");
				printer.close();
				return;
			}
		}
		printer.println("YES");
		printer.close();
	}

	static boolean[] visited;

	static void dfs(int cV) {
		visited[cV] = true;
		for (int pV : rList[cV]) {
			if (!visited[pV]) {
				dfs(pV);
			}
		}

		if (sConv[cV] != -1) {
			if (sup[cV] >= 0) {
				sup[sConv[cV]] += sup[cV];
			} else {
				if (Long.MAX_VALUE / rev[cV] < -sup[cV]) {
					printer.println("NO");
					printer.close();
					System.exit(0);
				}

				sup[sConv[cV]] += (long) rev[cV] * sup[cV];
			}
			sup[cV] = 0;
		}
	}

	static int[] cInd;

	static int[] lVisit;
	static ArrayDeque<Integer> cPath = new ArrayDeque<>();

	static void search(int cV, int cN) {
		lVisit[cV] = cN;
		cPath.add(cV);

		int aV = sConv[cV];

		if (lVisit[aV] == cN) {
			while (cPath.getLast() != aV) {
				cInd[cPath.removeLast()] = cV;
			}
			cInd[aV] = cV;
			sConv[cV] = -1;
			return;
		}
		if (lVisit[aV] == -1) {
			search(aV, cN);
		}
	}
}
