program cc;

var rc: array[1..20] of char;
    rc1: array[1..20] of integer;
    i,koniec,x,m,c: integer;
begin
    repeat
	x:=0;
	i:=0;
	rc1[11]:=0;
	koniec:=0;
	while not eoln do
	begin
	    i:=i+1;
	    read(rc[i]);
	    if (i<>7) and (rc[i]='/') then koniec:=1;
	    if (i=7) and (rc[i]<>'/') then koniec:=1;
	    if (i<>7) and (koniec=0) then rc1[i]:=ord(rc[i])-48;
	end;
	
	readln;
	if ((i<10) or (i>11)) then koniec:=1;
	if (((rc1[1]*10+rc1[2]) mod 100<20) and ((rc1[1]*10+rc1[2]) mod 100 >9)) then koniec:=1;
	m:=rc1[3]*10+rc1[4];

	if m<13 then x:=1;
	if ((m<51) and (m>12)) or (m>63) then koniec:=1;
	if koniec=0 then
	c:=rc1[1]+rc1[3]+rc1[5]+rc1[8]+rc1[10]-rc1[2]-rc1[4]-rc1[6]-rc1[9]-rc1[11];
	
	if c<>0 then
	if 11 mod c <> 0 then koniec:=1;
	
	if koniec=0 then
	begin
	    if x=1 then writeln ('boy')
	    else writeln ('girl');
	end
	else if rc[1]<>'e' then
	    writeln ('invalid');
	    
    until (rc[1]='e');
end.