program three_variables_game
  implicit none
  integer :: n, r(4) = 0, x(100001) = 0, i, j, p(2) = 0
  character(1) :: c(4) = (/ "A", "B", "X", "C" /)
  character(2) :: s
  read(*,*) n, r(1), r(2), r(4)
  if (sum(r) == 0) then
    write(*,'(a)') "No"
    stop
  end if
  do i = 1, n
    read(*,*) s
    x(i) = hash(s)
  end do
  if (sum(r) == 1) then
    j = maxloc(r,1)
    call simulate(.false.)
    r = 0
    r(j) = 1
    call simulate(.true.)
    stop
  end if
  call get_index(x(1),p)
  if (r(p(1)) == 0 .and. r(p(2)) == 0) then
    write(*,'(a)') "No"
    stop
  else
    write(*,'(a)') "Yes"
  end if
  do i = 1, n
    call get_index(x(i),p)
    j = 1
    if (sum(r) == 2 .and. r(p(1))*r(p(2)) == 1 .and. &
    & i < n .and. x(i) /= x(i+1) .and. p(2) == and(x(i),x(i+1))) then
      j = 2
    else if (r(p(1)) > r(p(2))) then
      j = 2
    end if
    r(p(j)) = r(p(j))+1
    r(p(3-j)) = r(p(3-j))-1
    write(*,'(a)') c(p(j))
  end do
contains
  integer function hash(s)
    character(2), intent(in) :: s
    select case (s)
      case ("AB")
        hash = 3
      case ("AC")
        hash = 5
      case ("BC")
        hash = 6
    end select
  end
  subroutine get_index(x,p)
    integer, intent(in) :: x
    integer, intent(out) :: p(2)
    integer :: i, k
    i = 0
    do k = 0, 2
      if (.not.btest(x,k)) cycle
      i = i+1
      p(i) = lshift(1,k)
    end do
  end
  subroutine simulate(out)
    logical, intent(in) :: out
    integer :: j
    if (out) write(*,'(a)') "Yes"
    do i = 1, n
      call get_index(x(i),p)
      if (r(p(1)) /= 0) then
        j = 2
      else if (r(p(2)) /= 0) then
        j = 1
      else
        write(*,'(a)') "No"
        stop
      end if
      r(p(3-j)) = r(p(3-j))-1
      r(p(j)) = r(p(j))+1
      if (out) write(*,'(a)') c(p(j))
    end do
  end
end program three_variables_game