var a,b,c,d:string[5];
k,l,err:integer;
begin
readln(a);
readln(b);
c:=copy(a,1,2);
d:=copy(b,1,2);
val(c,k,err);
val(d,l,err);
if k=0 then write ('24-hour clock') else
if k>12 then write ('24-hour clock') else
if l>12 then write ('24-hour clock') else
if l=12 then write ('both') else
write ('12-hour clock');
readln
end.
var a,b,c,d:string[5];
k,l,err:integer;
begin
readln(a);
readln(b);
c:=copy(a,1,2);
d:=copy(b,1,2);
val(c,k,err);
val(d,l,err);
if k=0 then write ('24-hour clock') else
if k>12 then write ('24-hour clock') else
if l>12 then write ('24-hour clock') else
if l=12 then write ('both') else
write ('12-hour clock');
readln
end.