# your code goes here #216 FAC N=int(input()) a=[int(i) for i in input().split()] b=[int(i) for i in input().split()] M=[0]*101 K=0 i=0 while i0: M[b[i]]+=a[i] else: K+=a[i] i+=1 S=0 i=0 while i=Ma: print("YES") else: print("NO")