n = gets.to_i

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

h = Hash.new(0)
u = Hash.new(0)
a.each {|e| h[e] += 1; u[e] += 1}
b.each {|e| u[e] += 1}

h = h.sort{|x, y| u[x[0]] != u[y[0]] ? u[y[0]] <=> u[x[0]] : y[0] <=> x[0]}

lim = h.size
i = 0
i += 1 while h[i][1] == 0

j = i + 1
j += 1 while j < lim && h[j][1] == 0

ans = []
n.times do |k|
    if b[k] == h[i][0]
        if j == lim
            puts "No"
            exit
        else
            ans << h[j][0]
            h[j][1] -= 1
            j += 1 while j < lim && h[j][1] == 0
        end
    else
        ans << h[i][0]
        h[i][1] -= 1
        i += 1 while i < lim && h[i][1] == 0
        if i >= j
            j = i + 1
            j += 1 while j < lim && h[j][1] == 0
        end
    end
end

puts "Yes"
puts ans * " "
