import java.io.*;
//import java.lang.Math;
import java.util.*;

class ii { // dd.java
	
	
	public static void main(String argv[])
	{
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		
		
		String pre = new String();
		String post = new String();
		
		int year;
		int month;
		int day;
		
		String pohlavi = new String();
		
		long number;
		
		try {
		while(true)
			
		{
			
			String vstup= stdin.readLine();
			StringTokenizer st;
			if(vstup.indexOf('/') != vstup.lastIndexOf('/'))
			{
				System.out.println("invalid");
				continue;	
			}
			//System.out.print(vstup+" : ");
			
			if (vstup.equals("end")) {
				//System.out.println("end");
				break;	}
			try {
				st = new StringTokenizer(vstup,"/");
			} catch (Exception e) {
				System.out.println("invalid");
				break;			
				}

			
			
			try {
			pre=st.nextToken();
			post=st.nextToken();
			
			number= Long.parseLong(pre+post);
			year = Integer.parseInt(pre.substring(0,2));
			month = Integer.parseInt(pre.substring(2,4));
			day = Integer.parseInt(pre.substring(4,6));
			}
			catch (Exception e){
				System.out.println("invalid");
				continue;
				}
			
			
			if (year<=9) {
				year+=2000;
				}
				
			else {year+=1900;}
			
			
			
			if (pre.length()!=6) {
				System.out.println("invalid");
				continue;
					
			}	
				
			if (post.length()==4) {
				if ( number % 11 != 0) {
					System.out.println("invalid");
					continue;
					}
			}
			
			if (year < 1920 || year > 2009){
				System.out.println("invalid");
				continue;}
			
			if (year > 1953 && post.length()!=4){
				System.out.println("invalid");
				continue;}
				
			if (year <= 1953 && post.length()!=3){
				System.out.println("invalid");
				continue;}
			boolean finish = false;
			switch (month) {
				case 1: 
				case 3:
				case 5:
				case 7:
				case 8:
				case 10:
				case 12: 
					if (day > 31 || day<1) {
						System.out.println("invalid");
						finish = true;
						}
					break;
				case 4:
				case 6:
				case 9:
				case 11:
					if (day > 30 || day<1) {
						System.out.println("invalid");
						finish = true;
						}
					break;
				case 2:
					GregorianCalendar g = new GregorianCalendar();
					if (year % 4 == 0) {
						if (day > 29 || day<1) {
						System.out.println("invalid");
						finish = true;
						} 
					} else {
						if (day > 28 || day<1) {
						System.out.println("invalid");
						finish = true;
						} 
					}
					
				
				default: break;
				
				}
				if(finish) continue;
				
			if (month>50) {
			
				
				if (month>62) {
					System.out.println("invalid");
					continue;
				} else
					System.out.println("girl");
			}
			else {
				if (month>12 || month<1) {
					System.out.println("invalid");
					continue;
				} else System.out.println("boy");
			}
			
			
			
			/*int c = stdin.read();
			
			if(c == (int)'e') {
				System.out.println("end");
				break;
			}
			
			c = stdin.read();
			*/
			}
			
			
		
		}
		catch(IOException e)
		{
			}
		
		
		
	}
}