require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)

left = []
right = []

i = 0
j = 0
si = 0
sj = 0
while i < n && j < n
  while a[i] == a[i+1]
    i += 1
  end
  while b[j] == b[j+1]
    j += 1
  end
  if a[i] > b[j]
    j += 1
    sj = j
  elsif a[i] < b[j]
    i += 1
    si = i
  else
    left.push j - si + 1
    right.push i - sj + 1

    j += 1
    sj = j
    i += 1
    si = i
  end
end

# p left
# p right
lmax = left.max
rmax = right.max
if left.empty?
  puts 'Yes'
  puts b.join(' ')
elsif lmax + rmax > n
  puts 'No'
else
  puts 'Yes'
  rmax.times do
   b.unshift b.pop
  end
  puts b.join(' ')
end