#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("pre_meiji\n");
 }
 else if (date_number < taisho_number) {
     printf("meiji");
     printf(" %d %d %d\n", year - 1867, month, day);
 }
 else if (date_number < showa_number) {
     printf("taisho");
     printf(" %d %d %d\n", year - 1911, month, day);
 }
 else if (date_number < heisei_number) {
     printf("showa");
     printf(" %d %d %d\n!", year - 1925, month, day);
 } else {
     printf("heisei");
     printf(" %d %d %d\n", year - 1988, month, day);
 }
}