One day *n* cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move *i*-th cell can exchange it's value with the value of some other *j*-th cell, if |*i* - *j*| = *d*<sub class="lower-index">*i*</sub>, where *d*<sub class="lower-index">*i*</sub> is a favourite number of *i*-th cell. Cells make moves in any order, the number of moves is unlimited.

The favourite number of each cell will be given to you. You will also be given a permutation of numbers from 1 to *n*. You are to determine whether the game could move to this state.
The first line contains positive integer *n* (1 ≤ *n* ≤ 100) — the number of cells in the array. The second line contains *n* distinct integers from 1 to *n* — permutation. The last line contains *n* integers from 1 to *n* — favourite numbers of the cells.
from collections import deque


def solve():
	n = int(input())
	arr1 = list(map(int,input().split()))
	arr2 = list(map(int,input().split()))
	parent = [i for i in range(n+1)]
	rank = [0]*(n+1)
	def find(x,parent):
		if x!=parent[x]:
			parent[x] = find(parent[x],parent)
		return parent[x]
	def union(x,y,parent,rank):
		if rank[x]>rank[y]:
			parent[y] = x
		elif rank[y]>rank[x]:
			parent[x] = y
		else:
			rank[x]+=1
			parent[y] = x
	for i in range(n):
		if i+1+arr2[i]<=n:
			x = find(i+1,parent)
			y = find(arr2[i]+i+1,parent)
			if x!=y:
				union(x,y,parent,rank)
		if i+1-arr2[i]>0:
			x = find(i+1,parent)
			y = find(i+1-arr2[i],parent)
			if x!=y:
				union(x,y,parent,rank)
	for i in range(n):
		x = find(i+1,parent)
		y = find(arr1[i],parent)
		if x!=y:
			print("NO")
			return
	print("YES")


























t = 1
#t = int(input())

for i in range(t):
	solve()