uses crt;
var a,b,c,d,ch:integer;
begin
a:=0; b:=0; c:=0; d:=0;
readln(ch);
a:=ch div 1000;
b:= (ch div 100) mod 10;
c:=(ch div 10)mod 10;
d:=ch mod 10;
if ((a =6) or ( b = 6) or (c = 6 ) or ( d = 6)) then
writeln('YES') else writeln('NO');
readln;
end.