n = $stdin.readline.to_i
a = $stdin.readline.chomp.split.map(&:to_i)
b = $stdin.readline.chomp.split.map(&:to_i).reverse!

n.times do |i|
  if a[i] == b[i]
    j = a[i..].bsearch_index {|x| x > b[i] } || (n - i)
    if j + i >= n
      puts "No"
      exit
    end

    b[j + i], b[i] = b[i], b[j + i]
    if a[i] == b[i]
      puts "No"
      exit
    end
  end
end

puts "Yes"
puts b.join(" ")