;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro with-output-buffer (&body body)
  "Buffers all outputs to *STANDARD-OUTPUT* in BODY and flushes them to
*STANDARD-OUTPUT* after BODY has been done (without error). Note that only
BASE-CHAR is allowed."
  (let ((out (gensym)))
    `(let ((,out (make-string-output-stream :element-type 'base-char)))
       (let ((*standard-output* ,out))
         ,@body)
       (write-string (get-output-stream-string ,out)))))

(declaim (inline natural-to-gray))
(defun natural-to-gray (x)
  (declare (unsigned-byte x))
  (logxor x (ash x -1)))

(declaim (inline natural-to-gray))
(defun gray-to-natural (x)
  (declare (unsigned-byte x))
  (do ((pos (- (integer-length x) 2) (- pos 1)))
      ((< pos 0) x)
    (setf (ldb (byte 1 pos) x)
                 (logxor (ldb (byte 1 pos) x)
                         (ldb (byte 1 (+ pos 1)) x)))))

(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (let* ((n (read))
         (a (read))
         (b (read))
         (a^b (logxor a b))
         (upper-a^b (ash (gray-to-natural a^b) -1))
         (upper-bound (ash 1 (- n 1))))
    (declare ((integer 1 17) n)
             (uint32 a b upper-a^b upper-bound))
    (when (evenp (logcount a^b))
      (write-line "NO")
      (return-from main))
    (write-line "YES")
    (labels ((get-original (upper lsb)
               (declare (uint32 upper lsb))
               (logxor a (+ lsb (ash (natural-to-gray upper) 1)))))
      (with-output-buffer
        (if (logbitp 0 a^b)
            (progn
              (loop for i below upper-a^b by 2
                    do (format t "~D " (get-original i 0))
                       (format t "~D " (get-original i 1))
                       (format t "~D " (get-original (+ i 1) 1))
                       (format t "~D " (get-original (+ i 1) 0)))
              (loop for i from upper-a^b below upper-bound
                    do (format t "~D " (get-original i 0)))
              (loop for i from (- upper-bound 1) above upper-a^b
                    do (format t "~D " (get-original i 1))
                    finally (format t "~D~%" (get-original upper-a^b 1))))
            (progn
              (format t "~D " (get-original 0 0))
              (format t "~D " (get-original 0 1))
              (loop for i from 1 below upper-a^b by 2
                    do (format t "~D " (get-original i 1))
                       (format t "~D " (get-original i 0))
                       (format t "~D " (get-original (+ i 1) 0))
                       (format t "~D " (get-original (+ i 1) 1)))
              (loop for i from upper-a^b below upper-bound
                    do (format t "~D " (get-original i 1)))
              (loop for i from (- upper-bound 1) above upper-a^b
                    do (format t "~D " (get-original i 0))
                    finally (format t "~D~%" (get-original upper-a^b 0)))))))))

#-swank(main)



Measured memory_bytes: 19688