program ii; var line, first, second:string; year, x, month, day, yc, limit:integer; girl : boolean; 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; if(month = 2) then if(year mod 4 = 0) then limit := 29 else limit := 28; if(month = 3) then limit := 31; if(month = 4) then limit := 30; if(month = 5) then limit := 31; if(month = 6) then limit := 30; if(month = 7) then limit := 31; if(month = 8) then limit := 31; if(month = 9) then limit := 30; if(month = 10) then limit := 31; if(month = 11) then limit := 30; 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) then yc := 3 else yc:= 4; if(length(second) = yc) then begin if(girl) then writeln('girl') else writeln('boy'); end else writeln('invalid'); end else writeln('invalid'); end else writeln('invalid'); end; until line = 'end'; end.