program line;
var
z:file of integer;
x,i,c,d,e,r:integer;
begin
assign (z,'line.in');
reset(z);
read(x);
for i:=1 to x do
read(c);
d:=c*5;
if d > 143
then
write('NO')
else
e:=d div 60;
r:=d mod 60;
write('',e,r);
close(z);
end.


