Problem:
Score : 600 points

Problem Statement

Given are two sequences A and B, both of length N.
A and B are each sorted in the ascending order.
Check if it is possible to reorder the terms of B so that for each i (1 \leq i \leq N) A_i \neq B_i holds, and if it is possible, output any of the reorderings that achieve it.

Constraints

1\leq N \leq 2 \times 10^5

1\leq A_i,B_i \leq N

A and B are each sorted in the ascending order.

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \cdots A_N
B_1 B_2 \cdots B_N

Output

If there exist no reorderings that satisfy the condition, print No.

If there exists a reordering that satisfies the condition, print Yes on the first line.
After that, print a reordering of B on the second line, separating terms with a whitespace.

If there are multiple reorderings that satisfy the condition, you can print any of them.

Sample Input 1

6
1 1 1 2 2 3
1 1 1 2 2 3

Sample Output 1

Yes
2 2 3 1 1 1

Sample Input 2

3
1 1 2
1 1 3

Sample Output 2

No

Sample Input 3

4
1 1 2 3
1 2 3 3

Sample Output 3

Yes
3 3 1 2

Solution in Common Lisp (SBCL 2.0.3) (judge verdict: Runtime Error)

(defstruct queue (entrance nil) (exit nil))

(defun enqueue (item queue)
  (let ((cell (list item)))
    (if (queue-entrance queue)
        (setf (cdr (queue-entrance queue)) cell)
        (setf (queue-exit queue) cell))
    (setf (queue-entrance queue) cell)))

(defun dequeue (queue)
  (when (queue-exit queue)
    (prog1 (pop (queue-exit queue))
      (unless (queue-exit queue)
        (setf (queue-entrance queue) nil)))))

;;;; main
(defun main ()
  (let* ((n (read))
         (a (make-array (list n)))
         (b (make-array (list n)))
         (c (make-array (list n)))
         (stack nil))
    (loop :for i :from 0 :to (1- n)
          :do (setf (aref a i) (read)))
    (loop :for i :from 0 :to (1- n)
          :do (setf (aref b i) (read)))
    (loop :for i :downfrom (1- n) :to 0
          :do (push (aref b i) stack))
    ;;
    (loop :named main
          :with sub := (make-queue)
          :for i :from 0 :to (1- n)
          :do (loop :named inner
                    :for x := (pop stack)
                    :do (cond ((/= (aref a i) x)
                               (setf (aref c i) x)
                               (return-from inner nil))
                              (t
                               (enqueue x sub)))
                    :if (null stack)
                    :do (progn
                           (format t "No~%")
                           (return-from main)))
          :do (setf stack (queue-exit sub))
          :do (setf sub (make-queue))
          :finally (progn
                     (format t "Yes~%")
                     (loop :for j :from 0 :to (- n 2)
                           :do (format t "~A " (aref c j))
                           :finally (format t "~A~%" (aref c (1- n))))))))
(main)