

import java.io.*;

class ii {

	public static void main(String[] args) {
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] numbers;
		try {
			while( (line = stdin.readLine()) != null) {
				if(line.compareTo("end") == 0) {
					break;
				}

				line = line.trim();
				if(line.length() < 10) {
					System.out.println("invalid");
					continue;
				}

				if(line.indexOf("/") == -1){
					System.out.println("invalid");
					continue;
				}

				numbers = line.split("/");

				if(numbers.length != 2){
					System.out.println("invalid");
					continue;
				}

				if(numbers[0].length() != 6 ) {
					System.out.println("invalid");
					continue;
				}

				if(numbers[1].length() != 3 && numbers[1].length() != 4) {
					System.out.println("invalid");
					continue;
				}

				if(numbers[1].length() == 3) {
					int tmp3 = Integer.parseInt(numbers[0]);
					if(tmp3 >= 540000) {
						System.out.println("invalid");
						continue;
					}
				}

				if(numbers[1].length() == 4) {
					int tmp3 = Integer.parseInt(numbers[0]);
					if(tmp3 < 540000 && tmp3 > 100000) {
						System.out.println("invalid");
						continue;
					}
					long tmp = Long.parseLong(numbers[0] + numbers[1]);

					if((tmp % 11) != 0 ) {
						System.out.println("invalid");
						continue;
					}
				}

				int year = Integer.parseInt(numbers[0].substring(0, 2));
				if(year < 10 ) {
					year += 2000;
				}else {
					year += 1900;
				}
				if(year < 1920 || year > 2009) {
					System.out.println("invalid");
					continue;
				}

				int month =  Integer.parseInt(numbers[0].substring(2, 4));
				int day =  Integer.parseInt(numbers[0].substring(4));

				month = (month >= 50) ? month - 50 :  month;
				
				if(month == 2) {
					if(day > 28){
						if((year % 4) != 0) {
							System.out.println("invalid");
							continue;
						}
					}
				}

				if(day > 31) {
					System.out.println("invalid");
					continue;
				}

				if(month == 4 || month == 6 || month == 9 || month == 11) {
					if(day > 30) {
						System.out.println("invalid");
						continue;
					}					
				}

				if(numbers[0].charAt(2) == '5' || numbers[0].charAt(2) == '6' ) {
					System.out.println("girl");					
				} else {
					System.out.println("boy");					
				}
					
			
					
				
			}

		} catch (IOException ex){}
	}
}
