n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) num = 0 for i in range(n): if b[i] < a[i]: print('YES') break else: num += 1 if num == n: print('NO')