#include <stdio.h>

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

int main(void)
{
    int y, m, d;
    while ((scanf("%d %d %d", &y, &m, &d)) != EOF) {
        judge_era(y, m, d);
    }
    return 0;
}

void judge_era(int year, int month, int day)
{
    if (year < 1868) {
      printf("pre-meiji\n");
      return;
    } else if (year == 1868) {
      if (month < 9) {
        printf("pre-meiji\n");
        return;
      } else if (month == 9) {
        if (day < 8) {
          printf("pre-meiji\n");
          return;
        } else {
          printf("meiji 1");
        }
      } else {
        printf("meiji 1");
      }
    } else if (year > 1869 && year < 1911) {
      printf("meiji %d", year - 1868);
    } else if (year == 1912) {
      if (month < 7) {
        printf("meiji 1");
      } else if (month == 7) {
        if (day < 29) {
          printf("meiji 1");
        } else {
          printf("taisho 1");
        }
      } else {
        printf("taisho 1");
      }
    } else if ( year > 1913 && year < 1925) {
      printf("taisho %d", year - 1912);
    } else if (year == 1926) {
      if (month < 12) {
        printf("taisho 1");
      } else if (month == 12) {
        if (day < 24) {
          printf("taisho 1");
        } else {
          printf("showa 1");
        }
      } else {
      printf("showa 1");
      }
    } else if (year > 1927 && year < 1988) {
      printf("showa %d", year - 1926);
   } else if (year == 1989) {
     if (month == 1) {
       if (day < 7) {
              printf("showa 1");
            } else {
              printf("heisei 1");
            }
          } else {
            printf("heisei 1");
          }
      } else if (year > 1990) {
      printf("heisei %d", year - 1989);
    }

    printf(" %d %d\n", month, day);
}