def main(): N = int(input()) A = tuple(map(int, input().split())) B = tuple(map(int, input().split())) score = dict() for i, j in zip(A, B): score[j] = score.get(j, 0) + i k = score[0] for i in score.values(): if k < i: print('NO') break else: print('YES') main()