program ii;

var line, first, second:string;
year, x, month, day, yc, limit:integer;
girl : boolean;
crc : longint;
ok : boolean;

function zvysok(slovo:string):integer;
var  zv, int, w, k, l: integer;
begin
	zv:=0;
	for w:=1 to 10 do begin
		val(slovo[w], l, k);
		int := zv * 10+l;
		zv := (int mod 11);
	end;
	zvysok:=zv;
end;

begin
repeat
readln(line);

if(line <> 'end') then begin
first := copy(line, 1, pos('/',line)-1);
second:= copy(line, pos('/', line)+1, 5);


if(length(first)=6) then begin

val(copy(first, 1,2), year, x);
val(copy(first, 3,2), month, x);
val(copy(first, 5,2), day, x);


if(month div 50) = 1 then girl := true else girl := false;
month := month mod 50;

if(month = 1) then limit := 31
else if(month = 2) then if(year mod 4 = 0) then limit := 29 else limit := 28
else if(month = 3) then limit := 31
else if(month = 4) then limit := 30
else if(month = 5) then limit := 31
else if(month = 6) then limit := 30
else if(month = 7) then limit := 31
else if(month = 8) then limit := 31
else if(month = 9) then limit := 30
else if(month = 10) then limit := 31
else if(month = 11) then limit := 30
else if(month = 12) then limit := 31;

if(year >= 0) and (year < 100) and (month > 0) and (month < 100) and (day > 0) and (day <= limit) then begin


if(year < 54) and (year >19) then yc := 3 else yc:= 4;

if(length(second) = yc) then begin

ok := true;

	if(length(second) = 4) then begin
		delete(line, 7, 1);
		if(zvysok(line) = 0) then ok := true else ok := false;
	end;

	if(ok) then
		if(girl) then writeln('girl')
		else writeln('boy')
	else writeln('invalid');


end
else writeln('invalid');



end
else writeln('invalid');


end
else writeln('invalid');
end;


until line = 'end';

end.

