<Problem>
http://ntucoder.net/Problem/Details/4397
Uses Crt;
Var i,d,doi:longint;
s:string;
count:array[1..15] of integer;
v:array['0'..'Z'] of integer;
Begin
FILLCHAR(COUNT,SIZEOF(COUNT),0);
v['3']:=3; v['4']:=4; v['5']:=5;
v['6']:=6; v['7']:=7; v['8']:=8; v['9']:=9;
v['T']:=10; v['J']:=11; v['Q']:=12; v['K']:=13; v['A']:=14; v['2']:=15;
for i:=1 to 13 do //Nhap 13 quan bai
begin
readln(s);
inc(count[v[s[1]]]);
end;
//for i:=3 to 15 do writeln(count[i]);
if count[15]=4 then begin
write('YES');
exit;
end;
d:=0;
for i:=3 to 15 do
if count[i]>0 then inc(d);
if d=13 then begin
write('YES');
exit;
end;
for i:=3 to 11 do
if (count[i]>1) and (count[i+1]>1) and (count[i+2]>1) and (count[i+3]>1) and (count[i+4]>1)
then
begin
write('YES');
exit;
end;
doi:=0;
for i:=3 to 15 do
doi:=doi+count[i] div 2;
if doi=6 then begin
write('YES');
exit;
end;
write('NO');
readln;
End.