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

f = Array.new(n)

i = j = l = 0
j += 1 while j < n && a[0] == a[j]

ans = []
n.times do |k|
    if a[k] == b[i]
        if j == n
            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] = b[i]
            begin; i += 1; end while i < n && f[i]
        else
            ans << b[j]
            f[j] = 0
            j += 1
        end
    else
        ans << b[i]
        begin; i += 1; end while i < n && f[i]
        j += 1 while j < n && a[i] == a[j]
    end
end

puts "Yes"
puts ans * " "
