END { load __FILE__ unless $stdin.eof? }

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

c = []

while (x = a[0])
  xi = a.bsearch_index { |e| e > x } || a.size
  a.slice!(0, xi)

  yj = (b[-1] > x) ? b.bsearch_index { |e| e > x } : 0
  b_sub1 = b.slice!(yj, xi)
  b_sub2 = (b_sub1.size < xi) ? b.slice!(0, xi - b_sub1.size) : []

  if b_sub2.any?(x)
    puts :No
    exit
  end

  c.concat(b_sub1, b_sub2)
end

puts :Yes
puts c * " "
