require 'pp'

n = gets.to_i
a_n = gets.split.map(&:to_i)
b_n = gets.split.map(&:to_i)

x = a_n.tally
y = b_n.tally
keys = y.keys
sum = {}
x.each do |k, v|
    t = v + (y[k] || 0) 
    if t > n
        puts 'No'
        exit 0
    end

    sum[k] = t
end
puts "Yes"

#pp x
#pp y
#pp keys
i = 0
ans = []
a_n.each do |a|
    if b_n[i] != a
        ans << b_n[i]
        i = (i + 1) % n
    else
        i = (i + 1) % n
        redo
    end     
end

puts ans.join(" ")
