import java.util.Scanner; class ii{ public static void main(String args[]){ String rc=" "; int cislo=0; int rok=0; int mesiac=0; int den=0; double priest; int []pole=new int[11]; Scanner sc=new Scanner(System.in); while(!(rc.equals("end"))){ rc=sc.nextLine(); System.out.println(rc); if((rc.length()>9)&&(rc.length()<12)){ for(int i=0;i6)&&(pole[i]==(-1))){ System.out.println("invalid2"); break; } } rok=pole[0]*10+pole[1]; if((rok>9)&&(rok<20)) System.out.println("invalid 6"); else if((((rok>53)||((rok>=0)&&(rok<=9)))&&(rc.length()!=11)))System.out.println("invalid 5"); else{ if(((rok>20)&&(rok<54))&&(rc.length()!=10))System.out.println("invalid 15"); else{ priest =rok; mesiac=pole[2]*10+pole[3]; den=pole[4]*10+pole[5]; if((mesiac==0)||(mesiac>12)||(den>31)){ if((mesiac<51)||(mesiac>62)||(den>31)) System.out.println("invalid 8"); }else if((priest % 4)==0){ System.out.println("priest"); if (((mesiac==2)||(mesiac==52))&&(den>29))System.out.println("invalid 9"); else{ if (mesiac==2)System.out.println("boy"); if (mesiac==52)System.out.println("girl"); } }if(((mesiac==2)||(mesiac==52))&&(den>28))System.out.println("invalid 7"); else { if(((mesiac==4)||(mesiac==6)||(mesiac==9)||(mesiac==11))&&(den>30))System.out.println("invalid 10"); if(((mesiac==54)||(mesiac==56)||(mesiac==59)||(mesiac==61))&&(den>30))System.out.println("invalid 11"); if (mesiac<50)System.out.println("boy"); if (mesiac>50)System.out.println("girl"); } }} }else System.out.println("invalid 4"); } } }