n=int(input()) d=map(int,input().split()) w=map(int,input().split()) uf=list(range(n)) rv=[False]*n def f(n): if n==uf[n]: return n else: uf[n]=f(uf[n]) return uf[n] def u(a,b): uf[f(a)]=f(b) for i,di in enumerate(d): a,b=(i+di)%n,(i-di)%n u(a,b) if a==b: rv[a]=True for i,b in enumerate(rv): n=f(i) if b: rv[n]=True for i in set([f(j) for j in uf]): cnt=0 for n,wi in enumerate(w): if uf[n]==i and wi==0: cnt+=1 if not rv[i] and cnt%2!=0: print("No") break else: print("Yes")