n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)

c = []
n.times do |i|
  c[i] = [a[i], b[i]]
end
c.sort_by! { |u| u[0] }
c.sort_by! { |u| u[1] }

a.sort!

count = n - 2

n.times do |i|
  if c[i][0] <= c[i][1]
    a.delete_at(a.find_index(c[i][0]))
  else
    if count < 0
      puts 'No'
      exit
    end
    p = a.shift
    (i+1).upto(n-i) do |t|
      if c[t][0] == p
        c[i][0], c[t][0] = c[t][0], c[i][0]
        break
      end
    end
    if c[i][0] <= c[i][1]
      count -= 1
    else
      puts 'No'
      exit
    end
  end
end
puts 'Yes'
