n = gets.to_i

A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)

if A.zip(B).count { |a, b| a > b } > n - 2
  puts "No"
  exit
end

ag = A.group_by { |i| i }
bg = B.group_by { |i| i }

a_sum = 0
b_sum = 0

ag_key = ag.keys.sort.each

if ag.keys.max > bg.keys.max
  puts "No"
  exit
end

bg.keys.sort.each do |b|
  b_sum += bg[b].size

  begin
    while ag_key.peek <= b
      a_sum += ag[ag_key.next].size
    end
  rescue StopIteration
  end

  if a_sum < b_sum
    puts "No"
    exit
  end
end

puts "Yes"
