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

index = 0

N.times do
    if num1[index] > num2[index]
        puts "No"
        break
    else
        index += 1
    end
end

if index == N
    puts "Yes"
end
