import java.util.Scanner;

public class ii {
	static String zpracuj(String inp) {
		for (int i = 0; i < inp.length(); i++) {
			if (i == 6) continue;
			if (!(inp.charAt(i) >= '0' && inp.charAt(i) <= '9')) return "invalid";
		}
		if (inp.charAt(6) != '/') return "invalid";
		//10
		if (Integer.parseInt(inp.substring(0,2)) >= 20 && Integer.parseInt(inp.substring(0,2)) < 54 && inp.length() != 10) return "invalid";
		//11
		if ((Integer.parseInt(inp.substring(0,2)) >= 54 || Integer.parseInt(inp.substring(0,2)) < 20) && inp.length() != 11) return "invalid";
		if (!(Integer.parseInt(inp.substring(2,4)) <= 12 && Integer.parseInt(inp.substring(2,4)) >= 1 ||
		    Integer.parseInt(inp.substring(2,4)) <= 62 && Integer.parseInt(inp.substring(2,4)) >= 51)) return "invalid";
		if (Integer.parseInt(inp.substring(4,6)) > 31 && Integer.parseInt(inp.substring(2,4)) % 50 == 1 ||
		    Integer.parseInt(inp.substring(4,6)) > 29 && Integer.parseInt(inp.substring(2,4)) % 50 == 2 ||
			Integer.parseInt(inp.substring(4,6)) > 31 && Integer.parseInt(inp.substring(2,4)) % 50 == 3 ||
			Integer.parseInt(inp.substring(4,6)) > 30 && Integer.parseInt(inp.substring(2,4)) % 50 == 4 ||
			Integer.parseInt(inp.substring(4,6)) > 31 && Integer.parseInt(inp.substring(2,4)) % 50 == 5 ||
			Integer.parseInt(inp.substring(4,6)) > 30 && Integer.parseInt(inp.substring(2,4)) % 50 == 6 ||
			Integer.parseInt(inp.substring(4,6)) > 31 && Integer.parseInt(inp.substring(2,4)) % 50 == 7 ||
			Integer.parseInt(inp.substring(4,6)) > 31 && Integer.parseInt(inp.substring(2,4)) % 50 == 8 ||
			Integer.parseInt(inp.substring(4,6)) > 30 && Integer.parseInt(inp.substring(2,4)) % 50 == 9 ||
			Integer.parseInt(inp.substring(4,6)) > 31 && Integer.parseInt(inp.substring(2,4)) % 50 == 10 ||
			Integer.parseInt(inp.substring(4,6)) > 30 && Integer.parseInt(inp.substring(2,4)) % 50 == 11 ||
			Integer.parseInt(inp.substring(4,6)) > 31 && Integer.parseInt(inp.substring(2,4)) % 50 == 12) return "invalid";
		if (Integer.parseInt(inp.substring(4,6)) == 29 && Integer.parseInt(inp.substring(2,4)) % 50 == 2 && 
		    Integer.parseInt(inp.substring(0,2)) % 4 != 0) return "invalid";
		if (inp.length() == 11) {
			if ((Long.parseLong(inp.substring(0, 6)) * 10000 + Integer.parseInt(inp.substring(7, 11))) % 11 != 0) return "invalid";
		}

		if (Integer.parseInt(inp.substring(2,4)) > 50) return "girl";
		else return "boy";
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String input = sc.nextLine();
		String vystup[] = new String[10000];
		int j = 0;
		vystup[j] = zpracuj(input);
		j++;
		while (!input.equals("end")) {
			input = sc.nextLine();
			if (input.equals("end")) break;
			vystup[j] = zpracuj(input);
			j++;
		}

		for (int i = 0; i < j; i++)
			System.out.println(vystup[i]);
	}
}
