#include #include #include #include #include #include using namespace std; bool priest(int year) { if (year < 10) year += 2000; else year += 1900; return ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))); } int main() { int mon1[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int mon2[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; while (1) { int b, e; string ch2; getline(cin, ch2); if (sscanf(ch2.c_str(), "%d/%d", &b, &e) == 2) { int g = 0; for (int i=0; i1) in = true; else { int sest, tri; sest = ch2.find('/'); tri = ch2.size() - (sest+1); //printf("%d %d\n",sest, tri); if (sest != 6) in = true; if (y >= 20 && y <= 53) { if (tri == 4) in = true; } else if (tri == 3) in = true; } bool debug = 0; if (debug) printf ("%d %d %d - %d, %d\n", y,m,d,b,e); bool girl = m > 50; if (girl) m-=50; if (debug) printf ("%d\n", in); if (y < 20 && y > 9) in = true; if (debug) printf ("%d\n", in); if (m == 0 || m > 12) in = true; if (debug) printf ("%d\n", in); if (d == 0 || d > 31) in = true; if (debug) printf ("%d\n", in); if (!in && priest(y) && d > mon2[m-1]) in = true; if (debug) printf ("priest =%d %d\n",priest(y), in); if (!in && !priest(y) && d > mon1[m-1]) in = true; if (debug) printf ("%d\n", in); long long int all = b; all *= 10000; all += e; if (all % 11) in = true; if (debug) printf ("%d %lld\n", in, all); if (in) printf("invalid\n"); else if (girl) { printf ("girl\n"); } else printf("boy\n"); } else { if (ch2[0]=='e') return 0; printf ("invalid\n"); } } return 0; }