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

d = a.zip(b)

count = 0
d.each_with_index do |e, i|
  next if e[0] <= e[1]
  if j = d.find_index { |f| f[0] <= e[1] && e[0] <= f[1] }
    d[i][0], d[j][0] = d[j][0], d[i][0]
    count += 1
  else
    puts 'No'
    exit
  end
end
puts count <= n - 2 ? 'Yes' : 'No'
