#include<iostream>
#include<sstream>

using namespace std;

int days[12] = {31, 29, 31, 30, 31 ,30 ,31,31,30,31,30,31};

bool prestup (int year)
{
  return (year % 4 == 0);
    
}

int main()
{
  string input;
  
  while (true)
  {
    cin >> input;
    if (input == "end")
      break;
    if ((input.length() == 10 || input.length() == 11) && input[6] == '/')
    {
      bool stop = false;
      for (unsigned int i = 0; i < input.length(); i++)
      {
	if (i != 6 && input[i] == '/')
	{
	  cout << "invalid" << endl;
	  stop = true;
	}
	if (i!= 6 &&( input[i] < '0' || input[i] > '9'))
	  {
	  cout << "invalid" << endl;
	  stop = true;
	}
      }
      if (stop) continue;
      string year = input.substr(0, 2);
      stringstream sy, sm, sd, sr;
      sy << year;
      long long numyear, nummonth, numday, numrest;
      sy >> numyear;
      string month = input.substr(2, 2);
      sm << month;
      sm >> nummonth;
      string day = input.substr(4, 2);
      sd << day;
      sd >> numday;
      string rest = input.substr(7, 4);
      sr << rest;
      sr >> numrest;
      if (nummonth < 1 || numday < 1)
      {
	cout << "invalid" << endl;
	continue;
      }
      if ((nummonth > 12 && nummonth < 51) || nummonth > 62)
      {
	cout << "invalid" << endl;
	continue;
      }
      bool girl = false;
      if (nummonth > 50)
	girl = true;
//      cout << nummonth << " " << numday << " ";
      int canmonth = nummonth % 50;
  //    cout << canmonth << " ";
      if (numday > days[canmonth - 1])
      {
	cout << "invalid" << endl;
	continue;
      }

      if (!prestup(numyear) && nummonth == 2 && numday > 28 )
      {
	cout << "invalid" << endl;
	continue;
      }
      if (input.length() == 10 && (numyear > 53 || numyear < 20))
      {
	cout << "invalid" << endl;
	continue;
      }
      if (input.length() == 11 && numyear < 54 && numyear >= 20 )
      {
	
	cout << "invalid" << endl;
	continue;
      }
      if (input.length() == 11)
      {
	long long num = numyear * 100000000 + nummonth * 1000000 + numday * 10000 + numrest;
	//cout << num << " " << (num % 11) << " ";
	if (num % 11 != 0)
	{
	  cout << "invalid" << endl;
	  continue;
	}
      }
      //      cout << 1;
      if (girl)
	cout << "girl" << endl;
      else
	cout << "boy" << endl;
      //cout << numyear << numday << nummonth << numrest;
    }
    else
      cout << "invalid" << endl;
  }
}

