program Ix_11;
const man=20:
var c: stings
function judge(c: string) : boolean;
var starray[1. . maxn] of char;
tOp.l:integer:
ch: char;
begin
judge: = true;
top: =0;
i:=1;ch: =cLi];
while ch<>'@' do begin
if (ch='(') or (ch=*)*) then case ch of
'(' : begin top: =top+ 1;s[top]: ="(' end;
")': if top>0 then top: = top-1
else begin judge: = false; exit end;
end;
i: =i+1;ch: =cil:
end;
if top<>0 then judge: = false;
end;
begin (main)
assign(input, ' match. in');
assign (output, 'match. out');
reset (input);
rewrite(output);
readIn(c) ;
if judge(c) then writeln('YES') else writeln('NO');
close (input);
close(output);
end.