n = gets.to_i
nums_a = gets.split.map(&:to_i)
nums_b = gets.split.map(&:to_i)
280.times do |i|
  if i.even?
    nums_b_rotated = nums_b.rotate(i * Random.rand(2000))
  else
    nums_b_rotated = nums_b.shuffle
  end
  judge = true
  n.times do |j|
    if nums_a[j] == nums_b_rotated[j]
      judge = false
      break
    end
  end
  if judge
    puts "Yes"
    puts nums_b_rotated.join(" ")
    exit
  end
end
puts "No"
