#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, A: int, B: int, C: int, s: "List[str]"):
    L = ["A" for _ in range(N)]
    for i in range(N):
        if s[i] == "AB":
            if A == 0 and B == 0:
                print(NO)
                return
            else:
                if A > B:
                    A -= 1
                    B += 1
                    L[i] = "B"
                elif A < B:
                    A += 1
                    B -= 1
                    L[i] = "A"
                else:
                    if i == N - 1:
                        A -= 1
                        B += 1
                        L[i] = "B"
                    else:
                        if s[i+1] == "AB":
                            A -= 1
                            B += 1
                            L[i] = "B"
                        elif s[i+1] == "BC":
                            A -= 1
                            B += 1
                            L[i] = "B"
                        else:   # AC
                            A += 1
                            B -= 1
                            L[i] = "A"
        elif s[i] == "BC":
            if B == 0 and C == 0:
                print(NO)
                return
            else:
                if B > C:
                    B -= 1
                    C += 1
                    L[i] = "C"
                elif B < C:
                    B += 1
                    C -= 1
                    L[i] = "B"
                else:
                    if i == N - 1:
                        B -= 1
                        C += 1
                        L[i] = "C"
                    else:
                        if s[i+1] == "AB":
                            B += 1
                            C -= 1
                            L[i] = "B"
                        elif s[i+1] == "BC":
                            B -= 1
                            C += 1
                            L[i] = "C"
                        else:   # AC
                            B -= 1
                            C += 1
                            L[i] = "C"
        else:   # AC
            if A == 0 and C == 0:
                print(NO)
                return
            else:
                if A > C:
                    A -= 1
                    C += 1
                    L[i] = "C"
                elif A < C:
                    A += 1
                    C -= 1
                    L[i] = "A"
                else:
                    if i == N - 1:
                        A -= 1
                        C += 1
                        L[i] = "C"
                    else:
                        if s[i+1] == "AB":
                            A += 1
                            C -= 1
                            L[i] = "A"
                        elif s[i+1] == "BC":
                            A -= 1
                            C += 1
                            L[i] = "C"
                        else:   # AC
                            A -= 1
                            C += 1
                            L[i] = "C"
    print(YES)
    for l in L:
        print(l)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, A, B, C, s)

if __name__ == '__main__':
    main()

Measured memory_bytes: 81532