n = gets.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
a1, b = [a,b].transpose.sort.transpose
b1 = b.sort
judge = "No"
n.times do |i1|
  j = 0
  if b[i1] == b1[i1 - j] then
    judge = "Yes"
    break
  elsif a1[i1] <= b1[i1 - j] && j < i1 then
    j += 1
    redo
  end
end
n.times do |i|
  if a1[i] > b1[i] then
    judge = "No"
    break
  end
end
puts judge