Problem: There is a game that involves three variables, denoted A, B, and C.

As the game progresses, there will be N events where you are asked to make a choice. Each of these choices is represented by a string s_i. If s_i is `AB`, you must add 1 to A or B then subtract 1 from the other; if s_i is `AC`, you must add 1 to A or C then subtract 1 from the other; if s_i is `BC`, you must add 1 to B or C then subtract 1 from the other.

After each choice, none of A, B, and C should be negative.

Determine whether it is possible to make N choices under this condition. If it is possible, also give one such way to make the choices.

Constraints

* 1 \leq N \leq 10^5
* 0 \leq A,B,C \leq 10^9
* N, A, B, C are integers.
* s_i is `AB`, `AC`, or `BC`.

Input

Input is given from Standard Input in the following format:


N A B C
s_1
s_2
:
s_N


Output

If it is possible to make N choices under the condition, print `Yes`; otherwise, print `No`.

Also, in the former case, show one such way to make the choices in the subsequent N lines. The (i+1)-th line should contain the name of the variable (`A`, `B`, or `C`) to which you add 1 in the i-th choice.

Examples

Input

2 1 3 0
AB
AC


Output

Yes
A
C


Input

3 1 0 0
AB
BC
AB


Output

No


Input

1 0 9 0
AC


Output

No


Input

8 6 9 1
AC
BC
AB
BC
AC
BC
AB
AB


Output

Yes
C
B
B
C
C
B
A
A

Solution (in JAVA):

Solution:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.function.DoubleUnaryOperator;
import java.util.function.IntUnaryOperator;
import java.util.function.LongUnaryOperator;
import static java.lang.Math.min;



public class Main {
    public static void main(String[] args) {
        StringBuilder out = new StringBuilder();
        solve(out);
        PrintWriter pw = new PrintWriter(System.out);
        pw.println(out);
        pw.flush();
        pw.close();
    }

    public static void solve(StringBuilder out) {
        int n = In.ni();
        int a = In.ni();
        int b = In.ni();
        int c = In.ni();
        String[] s = new String[n];
        for (int i = 0; i< n; i++) {
            s[i] = In.ns();
        }
        boolean[][][][] dp = new boolean[4][4][4][n + 1];
        int[][][][] prev = new int[4][4][4][n + 1];
        for (int i = 0; i <= min(3, a); i++) {
            for (int j = 0; j <= min(3, b); j++) {
                for (int k = 0; k <= min(3, c); k++) {
                    dp[i][j][k][0] = true;
                }
            }
        }
        for (int i = 0; i < n; i++) {
            for (int p = 0; p <= 3; p++) {
                for (int q = 0; q <= 3; q++) {
                    for (int r = 0; r <= 3; r++) {
                        if (dp[p][q][r][i]) {
                            int f = f(p, q, r);
                            if (s[i].equals("AB")) {
                                if (q > 0) {
                                    dp[min(3,p+1)][q-1][r][i+1]=true;
                                    prev[min(3,p+1)][q-1][r][i+1]=f;
                                }
                                if (p > 0) {
                                    dp[p-1][min(3,q+1)][r][i+1]=true;
                                    prev[p-1][min(3,q+1)][r][i+1]=f;
                                }
                            } else if (s[i].equals("BC")) {
                                if (r > 0) {
                                    dp[p][min(q+1,3)][r-1][i+1]=true;
                                    prev[p][min(q+1,3)][r-1][i+1]=f;
                                }
                                if (q > 0) {
                                    dp[p][q-1][min(r+1,3)][i+1]=true;
                                    prev[p][q-1][min(r+1,3)][i+1]=f;
                                }
                            } else {
                                if (p > 0) {
                                    dp[p-1][q][min(3,r+1)][i+1]=true;
                                    prev[p-1][q][min(3,r+1)][i+1]=f;
                                }
                                if (r > 0) {
                                    dp[min(3,p+1)][q][r-1][i+1]=true;
                                    prev[min(3,p+1)][q][r-1][i+1]=f;
                                }
                            }
                        }
                    }
                }
            }
        }
        System.out.println();
        for (int p = 0; p <= 3; p++) for (int q = 0; q <= 3; q++) for (int r = 0; r <= 3; r++) {
            if (dp[p][q][r][n]) {
                for (int i = n - 1; i >= 0; i--) {
                    int pre = prev[p][q][r][i+1];
                    int pp = pre / 16;
                    int qq = (pre / 4) % 4;
                    int rr = pre % 4;
                    if (s[i].equals("AB")) {
                        if (pp > p) {
                            out.append("B\n");
                        } else {
                            out.append("A\n");
                        }
                    } else if (s[i].equals("BC")) {
                        if (qq > q) {
                            out.append("C\n");
                        } else {
                            out.append("B\n");
                        }
                    } else {
                        if (rr > r) {
                            out.append("A\n");
                        } else {
                            out.append("C\n");
                        }
                    }
                    p = pp;
                    q = qq;
                    r = rr;
                }
                out.append("seY");
                out.reverse();
                return;
            }
        }
        out.append("No");
    }

    public static int f(int p, int q, int r) {
        return 16*p+4*q+r;
    }
}


/**
 * @author https://atcoder.jp/users/suisen
 */
final class In {
    public static final FastScanner fsc = new FastScanner();

    public static int ni() {
        return fsc.nextInt();
    }

    public static int ni(final IntUnaryOperator f) {
        return f.applyAsInt(fsc.nextInt());
    }

    public static int[] ni(final int n) {
        final int[] a = new int[n];
        Arrays.setAll(a, i -> fsc.nextInt());
        return a;
    }

    public static int[] ni(final int n, final IntUnaryOperator f) {
        final int[] a = new int[n];
        Arrays.setAll(a, i -> ni(f));
        return a;
    }

    public static int[][] ni(final int n, final int m) {
        final int[][] a = new int[n][m];
        Arrays.setAll(a, i -> ni(m));
        return a;
    }

    public static int[][] ni(final int n, final int m, final IntUnaryOperator f) {
        final int[][] a = new int[n][m];
        Arrays.setAll(a, i -> ni(m, f));
        return a;
    }

    public static long nl() {
        return fsc.nextLong();
    }

    public static long nl(final LongUnaryOperator f) {
        return f.applyAsLong(fsc.nextLong());
    }

    public static long[] nl(final int n) {
        final long[] a = new long[n];
        Arrays.setAll(a, i -> fsc.nextLong());
        return a;
    }

    public static long[] nl(final int n, final LongUnaryOperator f) {
        final long[] a = new long[n];
        Arrays.setAll(a, i -> nl(f));
        return a;
    }

    public static long[][] nl(final int n, final int m) {
        final long[][] a = new long[n][m];
        Arrays.setAll(a, i -> nl(m));
        return a;
    }

    public static long[][] nl(final int n, final int m, final LongUnaryOperator f) {
        final long[][] a = new long[n][m];
        Arrays.setAll(a, i -> nl(m, f));
        return a;
    }

    public static char[] nc() {
        return fsc.next().toCharArray();
    }

    public static char[][] nc(final int n, final int m) {
        final char[][] c = new char[n][m];
        Arrays.setAll(c, i -> nc());
        return c;
    }

    public static double nd() {
        return fsc.nextDouble();
    }

    public static double nd(final DoubleUnaryOperator f) {
        return f.applyAsDouble(fsc.nextDouble());
    }

    public static double[] nd(final int n) {
        final double[] a = new double[n];
        Arrays.setAll(a, i -> fsc.nextDouble());
        return a;
    }

    public static double[] nd(final int n, final DoubleUnaryOperator f) {
        final double[] a = new double[n];
        Arrays.setAll(a, i -> nd(f));
        return a;
    }

    public static double[][] nd(final int n, final int m) {
        final double[][] a = new double[n][m];
        Arrays.setAll(a, i -> nd(m));
        return a;
    }

    public static double[][] nd(final int n, final int m, final DoubleUnaryOperator f) {
        final double[][] a = new double[n][m];
        Arrays.setAll(a, i -> nd(m, f));
        return a;
    }

    public static String ns() {
        return fsc.next();
    }

    public static String[] ns(final int n) {
        final String[] s = new String[n];
        Arrays.setAll(s, i -> ns());
        return s;
    }

    public static boolean[][] grid(final int h, final int w, final char trueCharacter) {
        final boolean[][] grid = new boolean[h][w];
        for (int i = 0; i < h; i++) {
            final char[] s = fsc.next().toCharArray();
            for (int j = 0; j < w; j++) {
                grid[i][j] = s[j] == trueCharacter;
            }
        }
        return grid;
    }
}


final class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (final IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

    private static boolean isPrintableChar(final int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        final StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        final long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}