N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

flag = False

for i in range(N):
    if(B[i] - A[i] >= 0):
        flag = True
        break


A.sort()
B.sort()
for i in range(N):
    if(B[i] - A[i] < 0):
        flag = False
        break

if(flag):
    print("Yes")
else:
    print("No")