#include<stdio.h>

void era_transformation(int year, int month, int day);

int main(void)
{
  int year, month, day;
  while(scanf("%d %d %d", &year, &month, &day) != EOF) {
  era_transformation(year, month, day);
  }
  return 0;
}

void era_transformation(int year, int month, int day)
{
  int date_number = year * 10000 + month * 100 + day;
  int meiji_number = 1868 * 10000 + 9 * 100 + 8;
  int taisho_number = 1912 * 10000 + 7 * 100 + 30;
  int showa_number = 1926 * 10000 + 12 * 100 + 25;
  int heisei_number = 1989 * 10000 + 1 * 100 + 8;
  if (date_number < meiji_number) {
      printf(''&#157;pre_meiji'');
  }
  else if (date_number < taisho_number) {
      printf(''meiji'');
      printf('' %d %d %d\n''&#157;, year - 1867, month, day);
  }
  else if (date_number < showa_number) {
      printf(''taisho'');
      printf('' %d %d %d\n''&#157;, year - 1911, month, day);
  }
  else if (date_number < heisei_number) {
      printf(''&#157;showa''&#157;);
      printf(''&#157; %d %d %d\n'', year - 1925, month, day);
  } else {
      printf(''&#157;heisei'');
      printf(''&#157; %d %d %d\n''&#157;, year - 1988, month, day);
  }
}