# frozen_string_literal: true

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

ha = Hash.new { 0 }
hb = Hash.new { 0 }

a.each do |e|
  ha[e] += 1
end
b.each do |e|
  hb[e] += 1
end

as = ha.sort_by { |k, v| -v }
bs = hb.sort_by { |k, v| -v }
hc = Hash.new { |h, k| h[k] = [] }
as.each do |e, _|
  na = ha[e]
  bs.each do |f, _|
    next if e == f

    nb = hb[f]
    if na <= nb
      hb[f] -= na
      na.times { hc[e].push f }
      break
    else
      hb[f] = 0
      nb.times { hc[e].push f }
      na -= nb
    end
  end
end

c = []
hc.each do |k, v|
  c.push v
end
c.flatten!
if c.size != n
  puts 'No'
else
  puts 'Yes'
  puts c.join(' ')
end
