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.
n=int(input())
a=list(map(lambda x:int(x),input().split()))
fav=list(map(lambda x:int(x),input().split()))
class DisjSet:
    def __init__(self, n):
        # Constructor to create and
        # initialize sets of n items
        self.rank = [1] * n
        self.parent = [i for i in range(n)]
        self.extra = []

    # Finds set of given item x
    def find(self, x):

        # Finds the representative of the set
        # that x is an element of
        if (self.parent[x] != x):
            # if x is not the parent of itself
            # Then x is not the representative of
            # its set,
            self.parent[x] = self.find(self.parent[x])

        # so we recursively call Find on its parent
        # and move i's node directly under the
        # representative of this set

        return self.parent[x]

    # Do union of two sets represented
    # by x and y.
    def Union(self, x, y):

        # Find current sets of x and y
        xset = self.find(x)
        yset = self.find(y)

        # If they are already in same set
        if xset == yset:
            self.extra.append((x, y))
            return

        # Put smaller ranked item under
        # bigger ranked item if ranks are
        # different
        if self.rank[xset] < self.rank[yset]:
            self.parent[xset] = yset

        elif self.rank[xset] > self.rank[yset]:
            self.parent[yset] = xset

        # If ranks are same, then move y under
        # x (doesn't matter which one goes where)
        # and increment rank of x's tree
        else:
            self.parent[yset] = xset
            self.rank[xset] = self.rank[xset] + 1
obj=DisjSet(n)
for i in range(0,n):
    d=fav[i]
    if i-d>=0:
        obj.Union(i,i-d)
    if i+d<=n-1:
        obj.Union(i, i + d)
hashmap={}
for i in range(n):
    temp=obj.find(i)
    if temp not in hashmap:
        hashmap[temp]=set()
    hashmap[temp].add(i)
flag=1
for i in range(n):
    temp=obj.find(i)

    if a[i]-1 not in hashmap[temp]:
        flag=0
        break
# print(hashmap)
if flag==0:
    print("NO")
else:
    print("YES")
