N = gets.to_i
num1 = gets.split(" ").sort
num2 = gets.split(" ").sort

index = 0
ans = true

N.times do
    if num1[index] > num2[index]
        ans = false
        index += 1
    else
        index += 1
    end
end

if ans
    puts "Yes"
else
    puts "No"
end
