#include #include #include #include #include using namespace std; int months[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int monthsx[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int main(void) { char inp[21]; while (scanf("%s", inp) == 1) { if (strcmp(inp, "end") == 0) { return 0; } int a, b; if (sscanf(inp, "%d/%d", &a, &b) != 2) { printf("invalid\n"); continue; } int year = a/10000; int month = (a - year*10000) / 100; int day = (a - year*10000 - month*100) ; bool b53 = true; if (year > 9 && year < 54) { if (b >= 1000) b53 = false; } bool div11 = true; //cout << a << b << "mod = " << ((((a % 11)*10000) + b) % 11) << endl; if (year >= 54) { //if (((a % 11)*(10000 % 11)+(b % 11)) % 11 != 0) div11 = false; if ((((a % 11)*10000) + b) % 11 != 0) div11= false; } ///printf("y %d m %d d %d a %d b %d whole %d mod %d \n", year, month, day, a, b); bool bmonth = true; int mmonth = month; if (month > 50) mmonth -= 50; if (year == 00 || year % 4 == 0) { if (day > monthsx[mmonth-1]) bmonth = false; } else { if (day > months[mmonth-1]) bmonth = false; } if ( (!(year >= 10 && year <= 19)) && ((month > 0 && month < 13) || (month > 50 && month < 63)) && (day > 0 && day < 32) && (b53) && (bmonth) && (div11) ) { if (month > 50) printf("girl\n"); else printf("boy\n"); } else { printf("invalid\n"); continue; } } return 0; }