var
n,i,j,sum : longint;
s : string;
begin
readln(n);
for i :=1 to n do begin
readln(s);
sum :=0;
for j :=1 to length(s) do sum :=sum+ord(s[j])-ord('0');
sum :=sum mod 9;
if sum=0 then writeln('9, no')
else
if sum=2 then writeln('2, yes')
else writeln(sum,', no');
end
end.
var
n,i,j,sum : longint;
s : string;
begin
readln(n);
for i :=1 to n do begin
readln(s);
sum :=0;
for j :=1 to length(s) do sum :=sum+ord(s[j])-ord('0');
sum :=sum mod 9;
if sum=0 then writeln('9, no')
else
if sum=2 then writeln('2, yes')
else writeln(sum,', no');
end
end.