N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = {i:0 for i in range(100)} print("YES" if C[0] == max(C.values()) else "NO")