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): u((i+di)%n,(i-di)%n) if (i+di)%n==(i-di)%n: rv[(i+di)%n]=True for i,b in enumerate(rv): n=f(i) if b: rv[n]=True for i in set(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")