n = $stdin.readline.to_i
a = $stdin.readline.chomp.split.map(&:to_i)
b = $stdin.readline.chomp.split.map(&:to_i).reverse!
sw = []
ns = []

n.times do |i|
  if a[i] != b[i]
    sw << [i, b[i]]
  else
    ns << [i, b[i]]
  end
end

if ns.size > sw.size
  puts "No"
  exit
end

while !ns.empty?
  j, b = ns.pop
  k = sw.bsearch_index {|_, swb| - swb > - b }
  if !k.nil?
    sw[k][1], b = b, sw[k][1]
    sw << [j, b]
  else
    puts "No"
    exit
  end
end

puts "Yes"
puts sw.sort_by! {|j, _| j }.map {|_, b| b }.join(" ")