#include #include using namespace std; void die(){ cout << "invalid" << endl; } int M[12] = { 31, 28, 31, 30,31,30,31,31,30,31,30,31 }; int main(){ while(true){ string s; cin >> s; if (s == "end") break; if (s.length() < 10 || s.length() > 11){ die(); continue; } if (s[6] != '/'){ die(); continue; } for (int i=0;i '9'){ die(); continue; } } string ans = "boy"; string y = s.substr(0,2); string m = s.substr(2,2); string d = s.substr(4,2); // cout << "T " << y << endl; istringstream isy(y); int year; isy >> year; if ( year > 53 || year < 10){ if (s.length() == 10){ die(); continue; } }else{ if (s.length() == 11){ die(); continue; } } if (year > 9 && year < 20){ die(); continue; } // cout << "t2 " << endl; istringstream ism(m); int month; ism >> month; if (month == 0){ die(); continue;} if (month > 12 && month <= 50){ die(); continue; } if (month > 50 && month <= 62){ ans = "girl"; month -= 50; } if (month > 62){ die(); continue; } month--; //dni .. fck :( int day; istringstream isd(d); isd >> day; if (day == 0){ die(); continue; } if (month == 1){ if (year % 4 == 0){ if (day > M[1]+1){ die(); continue; } }else{ if (day > M[month]){ die(); continue; } } }else{ if (day > M[month]){ die(); continue; } } if (s.length() == 11){ string prve = s.substr(0,6); string druhe = s.substr(7,s.length()-7); long long a; istringstream is(prve+druhe); is >> a; if (a % 11 != 0){ die(); continue; } } cout << ans << endl; } return 0; }