#include <stdio.h>
 
void trans(int year, int month, int day)
{
    if (year < 1868) {
        printf("pre-meiji\n");
    } else if (year == 1868) {
        if (month < 9) {
            printf("pre-meiji\n");
        } else if (month == 9) {
            if (day < 8) {
                printf("pre-meiji\n");
            } else{
                printf("meiji %d %d %d\n", year - 1867, month, day);
            }
        } else{
            printf("meiji %d %d %d\n", year - 1867, month, day);
        }
    } else if (year < 1912) {
        printf("meiji %d %d %d\n", year - 1867, month, day);
    } else if (year == 1912) {
        if (month < 7) {
            printf("meiji %d %d %d\n", year - 1867, month, day);
        } else if (month == 7) {
            if (day < 30) {
                printf("meiji %d %d %d\n", year - 1867, month, day);
            } else{
                printf("taisho %d %d %d\n", year - 1911, month, day);
            }
        } else{
            printf("taisho %d %d %d\n", year - 1911, month, day);
        }
    } else if (year < 1926) {
        printf("taisho %d %d %d\n", year - 1911, month, day);
    } else if (year == 1926) {
        if (month < 12) {
            printf("taisho %d %d %d\n", year - 1911, month, day);
        } else if (month == 12) {
            if (day < 25) {
                printf("taisho %d %d %d\n", year - 1911, month, day);
            } else{
                printf("showa %d %d %d\n", year - 1925, month, day);
            }
        } else{
            printf("showa %d %d %d\n", year - 1925, month, day);
        }
    } else if (year < 1989) {
        printf("showa %d %d %d\n", year - 1925, month, day);
    } else if (year == 1989) {
        if (month == 1) {
            if (day < 8) {
                printf("showa %d %d %d\n", year - 1925, month, day);
            } else{
                printf("heisei %d %d %d\n", year - 1988, month, day);
            }
        }
    } else{
        printf("heisei %d %d %d\n", year - 1988, month, day);
    }
} 
 
int main(void)
{
    int year, month, day;

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