use std::io::Read;
use std::cmp::min;

fn main() {
    let mut line = String::new();
    std::io::stdin().read_to_string(&mut line).unwrap();
    let mut it = line.split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let mut a: usize = it.next().unwrap().parse().unwrap();
    let mut b: usize = it.next().unwrap().parse().unwrap();
    let mut c: usize = it.next().unwrap().parse().unwrap();
    let s: Vec<i32> = it.map(|a| match (a) {
        "AB" => 1,
        "BC" => 2,
        _ => 3,
    }).collect();

    a = min(a, 9);
    b = min(b, 9);
    c = min(c, 9);
    let sum = a + b + c;
    let orig_a = a;
    let orig_b = b;

    let mut dp = vec![vec![vec![0; (sum + 1)]; (sum + 1)]; n + 1];
    dp[0][a][b] = 1;
    for i in 0..n {
        for a in 0..=sum {
            for b in 0..=sum {
                if dp[i][a][b] == 0 {
                    continue;
                }
                let c = sum - a - b;
                if s[i] == 1 {
                    if a > 0 {
                        dp[i + 1][a - 1][b + 1] = 2;
                    }
                    if b > 0 {
                        dp[i + 1][a + 1][b - 1] = 1;
                    }
                } else if s[i] == 2 {
                    if b > 0 {
                        dp[i + 1][a][b - 1] = 3;
                    }
                    if c > 0 {
                        dp[i + 1][a][b + 1] = 2;
                    }
                } else {
                    if c > 0 {
                        dp[i + 1][a + 1][b] = 1;
                    }
                    if a > 0 {
                        dp[i + 1][a - 1][b] = 3;
                    }
                }
            }
        }
    }

    for a in 0..=sum {
        for b in 0..=sum {
            if dp[n][a][b] != 0 {
                println!("Yes");
                let mut cur_a = a;
                let mut cur_b = b;
                let mut cur_n = n;
                let mut ans = vec![0; n];
                for i in 0..n {
                    ans[cur_n - 1] = dp[cur_n][cur_a][cur_b];
                    if s[cur_n - 1] == 1 {
                        if dp[cur_n][cur_a][cur_b] == 1 {
                            cur_a -= 1;
                            cur_b += 1;
                        } else {
                            cur_a += 1;
                            cur_b -= 1;
                        }
                    } else if s[cur_n - 1] == 2 {
                        if dp[cur_n][cur_a][cur_b] == 2 {
                            cur_b -= 1;
                        } else {
                            cur_b += 1;
                        }
                    } else {
                        if dp[cur_n][cur_a][cur_b] == 3 {
                            cur_a += 1;
                        } else {
                            cur_a -= 1;
                        }
                    }
                    cur_n -= 1;
                }
                for a in &ans {
                    match(a) {
                        1 => println!("A"),
                        2 => println!("B"),
                        _ => println!("C"),
                    }
                }
                assert_eq!(cur_a, orig_a);
                assert_eq!(cur_b, orig_b);
                return;
            }
        }
    }
    println!("No");
}


Measured memory_bytes: 422448