(eval-when (:compile-toplevel :load-toplevel :execute)
  (sb-int:defconstant-eqx opt
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0))
    #'equal)
  #+swank (ql:quickload '(:cl-debug-print :fiveam) :silent t)
  #-swank (set-dispatch-macro-character
           #\# #\> (lambda (s c p) (declare (ignore c p)) `(values ,(read s nil nil t)))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)
#-swank (disable-debugger) ; for CS Academy

;; BEGIN_INSERTED_CONTENTS
(in-package :cl-user)

(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
;;;

(define-condition infeasible () ())
(defun solve-easy (n a b c ss)
  (let (res)
    (labels ((choose (x y)
               (ecase x
                 (a (incf a)) (b (incf b)) (c (incf c)))
               (ecase y
                 (a (decf a)) (b (decf b)) (c (decf c)))
               (push x res)))
      (dotimes (i n)
        (ecase (aref ss i)
          (ab (cond ((> a b) (choose 'b 'a))
                    ((< a b) (choose 'a 'b))
                    (t (if (= i (- n 1))
                           (choose 'a 'b)
                           (if (eql 'bc (aref ss (+ i 1)))
                               (choose 'b 'a)
                               ;; ab ac
                               (choose 'a 'b))))))
          (bc (cond ((> b c) (choose 'c 'b))
                    ((< b c) (choose 'b 'c))
                    (t (if (= i (- n 1))
                           (choose 'b 'c)
                           (if (eql 'ac (aref ss (+ i 1)))
                               (choose 'c 'b)
                               (choose 'b 'c))))))
          (ac (cond ((> c a) (choose 'a 'c))
                    ((< c a) (choose 'c 'a))
                    (t (if (= i (- n 1))
                           (choose 'c 'a)
                           (if (eql 'ab (aref ss (+ i 1)))
                               (choose 'a 'c)
                               (choose 'c 'a)))))))
        (unless (and (>= a 0) (>= b 0) (>= c 0))
          (error 'infeasible)))
      (nreverse res))))

(defun solve-hard (n a b c ss)
  (let ((dp (make-array (list (+ n 1) 3) :element-type 'bit :initial-element 0))
        (prevs (make-array (list (+ n 1) 3) :element-type 'list :initial-element nil)))
    (cond ((= a 1) (setf (aref dp 0 0) 1))
          ((= b 1) (setf (aref dp 0 1) 1))
          ((= c 1) (setf (aref dp 0 2) 1))
          (t (error "Huh?")))
    (dotimes (x n)
      (let ((s (aref ss x)))
        (dotimes (state 3)
          (when (or (and (eq s 'bc) (= state 0))
                    (and (eq s 'ac) (= state 1))
                    (and (eq s 'ab) (= state 2)))
            (setf (aref dp x state) 0))
          (when (= 1 (aref dp x state))
            (ecase state
              ;; aを持ってる
              (0 (ecase s
                   (ab
                    (setf (aref dp (+ x 1) 1) 1)
                    (setf (aref prevs (+ x 1) 1) (list x state 'b)))
                   (bc)
                   (ac
                    (setf (aref dp (+ x 1) 2) 1)
                    (setf (aref prevs (+ x 1) 2) (list x state 'c)))))
              ;; bを持ってる
              (1 (ecase s
                   (ab
                    (setf (aref dp (+ x 1) 0) 1)
                    (setf (aref prevs (+ x 1) 0) (list x state 'a)))
                   (bc
                    (setf (aref dp (+ x 1) 2) 1)
                    (setf (aref prevs (+ x 1) 2) (list x state 'c)))
                   (ac)))
              ;; cを持ってる
              (2 (ecase s
                   (ab)
                   (bc
                    (setf (aref dp (+ x 1) 1) 1)
                    (setf (aref prevs (+ x 1) 1) (list x state 'b)))
                   (ac
                    (setf (aref dp (+ x 1) 0) 1)
                    (setf (aref prevs (+ x 1) 0) (list x state 'a))))))))))
    (dotimes (state 3 (error 'infeasible))
      (when (= 1 (aref dp n state))
        (let ((x n)
              (state state)
              res)
          (loop repeat n
                for (prev-x prev-state sym) = (aref prevs x state)
                do (push sym res)
                   (setq x prev-x state prev-state))
          (return-from solve-hard res))))))

(defun main ()
  (let* ((n (read))
         (a (read))
         (b (read))
         (c (read))
         (ss (make-array n :element-type 'symbol)))
    (dotimes (i n)
      (setf (aref ss i) (read)))
    (when (= 0 a b c)
      (write-line "No")
      (return-from main))
    (handler-bind ((infeasible (lambda (c) (write-line "No") (return-from main))))
      (let ((res (if (>= (+ a b c) 2)
                     (solve-easy n a b c ss)
                     (solve-hard n a b c ss))))
        (write-line "Yes")
        (map () #'println res)))))

#-swank (main)

;;;
;;; Test and benchmark
;;;

#+swank
(defun io-equal (in-string out-string &key (function #'main) (test #'equal))
  "Passes IN-STRING to *STANDARD-INPUT*, executes FUNCTION, and returns true if
the string output to *STANDARD-OUTPUT* is equal to OUT-STRING."
  (labels ((ensure-last-lf (s)
             (if (eql (uiop:last-char s) #\Linefeed)
                 s
                 (uiop:strcat s uiop:+lf+))))
    (funcall test
             (ensure-last-lf out-string)
             (with-output-to-string (out)
               (let ((*standard-output* out))
                 (with-input-from-string (*standard-input* (ensure-last-lf in-string))
                   (funcall function)))))))

#+swank
(defun get-clipbrd ()
  (with-output-to-string (out)
    (run-program "powershell.exe" '("-Command" "Get-Clipboard") :output out :search t)))

#+swank (defparameter *this-pathname* (uiop:current-lisp-file-pathname))
#+swank (defparameter *dat-pathname* (uiop:merge-pathnames* "test.dat" *this-pathname*))

#+swank
(defun run (&optional thing (out *standard-output*))
  "THING := null | string | symbol | pathname

null: run #'MAIN using the text on clipboard as input.
string: run #'MAIN using the string as input.
symbol: alias of FIVEAM:RUN!.
pathname: run #'MAIN using the text file as input."
  (let ((*standard-output* out))
    (etypecase thing
      (null
       (with-input-from-string (*standard-input* (delete #\Return (get-clipbrd)))
         (main)))
      (string
       (with-input-from-string (*standard-input* (delete #\Return thing))
         (main)))
      (symbol (5am:run! thing))
      (pathname
       (with-open-file (*standard-input* thing)
         (main))))))

#+swank
(defun gen-dat ()
  (uiop:with-output-file (out *dat-pathname* :if-exists :supersede)
    (format out "")))

#+swank
(defun bench (&optional (out (make-broadcast-stream)))
  (time (run *dat-pathname* out)))

;; To run: (5am:run! :sample)
#+swank
(it.bese.fiveam:test :sample
  (it.bese.fiveam:is
   (common-lisp-user::io-equal "2 1 3 0
AB
AC
"
    "Yes
A
C
"))
  (it.bese.fiveam:is
   (common-lisp-user::io-equal "3 1 0 0
AB
BC
AB
"
    "No
"))
  (it.bese.fiveam:is
   (common-lisp-user::io-equal "1 0 9 0
AC
"
    "No
"))
  (it.bese.fiveam:is
   (common-lisp-user::io-equal "8 6 9 1
AC
BC
AB
BC
AC
BC
AB
AB
"
    "Yes
C
B
B
C
C
B
A
A
")))


Measured memory_bytes: 77140