#include<stdio.h>
 
void era_transform(int year, int month, int day);
 
int main(void)
{
    int year, month, day;
    while (scanf("%d %d %d", &year, &month, &day) != EOF {
         era_transform(year, month, day);
    }
    return 0;
}
 
void era_transform(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 %d %d %d\n", year - 1867, month, day);
    } else if (date_number < showa_number) {
        printf("taisho %d %d %d\n", year - 1911, month, day);
    } else if (date_number < heisei_number) {
        printf("showa %d %d %d\n", year - 1925, month, day);
    } else {
        printf("heisei %d %d %d\n", year - 1988, month, day);
    }
}