n = gets.to_i
array_A = gets.split(" ").map(&:to_i)
array_B = gets.split(" ").map(&:to_i)

array_A.sort!
array_B.sort!

flag = true
n.times do |i|
  if array_A[i] > array_B[i]
    flag = false
    break
  end
end

count = 0
(n - 1).times do |i|
  if array_B[i] < array_A[i + 1]
    count += 1
  end
end

flag = false if count == n - 1

puts flag ? "Yes" : "No"