unittest
{
	assert( [ "2 1 3 0", "AB", "AC" ].parse.expand.solve == "Yes\nA\nC" );
	assert( [ "3 1 0 0", "AB", "BC", "AB" ].parse.expand.solve == "No" );
	assert( [ "1 0 9 0", "AC" ].parse.expand.solve == "No" );
//	assert( [ "8 6 9 1", "AC", "BC", "AB", "BC", "AC", "BC", "AB", "AB" ].parse.expand.solve == "Yes\nC\nB\nB\nC\nC\nB\nA\nA" );
	assert( [ "8 6 9 1", "AC", "BC", "AB", "BC", "AC", "BC", "AB", "AB" ].parse.expand.solve == "Yes\nC\nC\nA\nC\nC\nC\nA\nB" );
	
	assert( [ "3 1 1 0", "AB", "BC", "AC" ].parse.expand.solve == "Yes\nB\nC\nA" );		// 追加ケース
	assert( [ "3 1 1 0", "AB", "AC", "BC" ].parse.expand.solve == "Yes\nA\nC\nB" );		// 追加ケース
	assert( [ "3 1 0 0", "AB", "BC", "AC" ].parse.expand.solve == "Yes\nB\nC\nA" );		// 追加ケース
}



import std.conv;
import std.format;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nabc = input.front.split.to!( long[] );
	auto ss = new string[ nabc[ 0 ] ];
	foreach( ref s; ss )
	{
		input.popFront;
		s = input.front;
	}
	return tuple( nabc[ 1 .. $ ], ss );
}

auto solve( long[] abc, string[] ss )
{
	// 変数が3つしかないので貪欲でいける
	auto anss = new string[ ss.length ];
	foreach( i, s; ss )
	{
		auto xc = s[ 0 ];
		auto yc = s[ 1 ];
		auto xi = cast( long )( xc - 'A' );
		auto yi = cast( long )( yc - 'A' );
		if( abc[ xi ] <= 0 && abc[ yi ] <= 0 ) return "No";
		if( abc[ xi ] < abc[ yi ] )
		{
			abc[ xi ]++;
			abc[ yi ]--;
			anss[ i ] = s[ 0 .. 1 ];
		}
		else if( abc[ yi ] < abc[ xi ] )
		{
			abc[ xi ]--;
			abc[ yi ]++;
			anss[ i ] = s[ 1 .. 2 ];
		}
		else
		{
			if( ss.length <= i + 1 || ss[ i + 1 ][ 0 ] == xc || ss[ i + 1 ][ 1 ] == xc )
			{
				abc[ xi ]++;
				abc[ yi ]--;
				anss[ i ] = s[ 0 .. 1 ];
			}
			else
			{
				abc[ xi ]--;
				abc[ yi ]++;
				anss[ i ] = s[ 1 .. 2 ];
			}
		}
	}
	return format( "Yes\n%s", anss.join( "\n" ) );
}
