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

oneans = a.sort.zip(b.sort)
if oneans.any?{|ai,bi|ai>bi}
  puts "No"
  exit
end

if oneans.each_cons(2).any?{|(a1,b1),(a2,b2)|b1>=a2}
  puts "Yes"
  exit
end

l=a.zip(b).sort_by{|ai,bi|bi}
a2 = l.map.with_index{|(ai,bi),i|[ai,i]}.sort

cnt = 1
i = 0
until a2[i][1] == 0
  i = a2[i][1]
  cnt += 1
end

puts cnt == n ? "No" : "Yes"