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| u[e] += 1}
b.each {|e| h[e] += 1; 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

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

l = 0
ans = []
n.times do |k|
    if a[k] == h[i][0] && j == lim
        l += 1 while a[l] != a[k] && ans[l] == a[k]
        
        if a[l] == a[k]
            puts "No"
            exit
        end
        ans << ans[l]
        ans[l] = h[i][0]
        h[i][1] -= 1
        i += 1 while i < lim && h[i][1] == 0
    elsif a[k] == h[i][0]
        ans << h[j][0]
        h[j][1] -= 1
        j += 1 while j < lim && h[j][1] == 0
    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 * " "
