import java.util.*;
import java.util.regex.*;

public class ii {
	
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		String line;
		
		
		Pattern p = Pattern.compile("(\\d{2})(\\d{2})(\\d{2})/(\\d{3,4})");

		while (sc.hasNextLine())
		{
			line = sc.nextLine();
			if (line.equals("end"))
			{
				break;
			}
			
			 Matcher m = p.matcher(line);
			
			boolean valid = true;
			boolean boy = false;
			boolean girl = false;
			
			if (m.matches())
			{
				int yy = Integer.parseInt(m.group(1));
				int mm = Integer.parseInt(m.group(2));
				int dd= Integer.parseInt(m.group(3));
				
				int z= Integer.parseInt(m.group(4));
				long c= Long.parseLong(line.replace("/",""));
				
				if (yy / 10 == 1) valid= false;
				if (mm > 0 && mm<=12) boy = true; 
								
				if (mm > 50 && mm<=62) girl = true;
				
				if (!boy && !girl)
					valid = false;
				
				if (!(dd>0 && dd<32))
					valid = false;
				
				if ( (yy>53 || yy<10) && line.length()!=11)
					valid=false;
				if (yy<=53 && yy>=20 && line.length()!=10)
					valid=false;
				
				if ( line.length()==11 && (c % 11 != 0))
					valid=false;
				
				if (valid)
				{
					if (girl)
						mm-=50;
					
					switch(mm)
					{

						case 4 :
							case 6 :
								case 9: 
								case 11:
						{
							if (dd>30)
								valid = false;
							break;
							}
						case 2:
						{							
							
							if (( (yy % 4 ==0) )  )
							{
								if (dd>29)
								 valid=false;
							}
							else
							{
								if (dd > 28)
								  valid = false;
							}
							break;
						}
						
					}						
				}				
				
			}
			else
			{
				valid=false;
			}
			
			if (!valid)
			{
				System.out.println("invalid");
			}
			else
			{
				System.out.println( (boy) ? "boy" : "girl");
			}

			
		}
		
	}
}