N = gets.to_i
A = gets.split.map &:to_i
B = gets.split.map &:to_i

count = 0
A.zip(B).each do |(a,b)|
  count += 1 if a > b
end

flag = true
if count > N - 2 
  puts "No"
  exit
elsif count == N - 2 && N.odd?
  flag = false
end

D = A.sort
E = B.sort

count = 0
D.zip(E).each do |(d,e)|
  count += 1 if d > e
end

if count > 0
  puts "No"
else
  if flag
    puts "Yes"
  else
    puts "No"
  end
end


