#include <stdio.h>

void judge(int year, int month, int day)
{
    if ((year < 1868) || ((year == 1868) && ((month < 9) || ((month == 9) && (day <= 7))))) {
        printf("pre-meiji\n");
    } else if ((year < 1912) || ((year == 1912) && ((month < 7) || ((month == 7) && (day <= 29))))) {
        printf("meiji %d %d %d\n", year - 1868 + 1, month, day);
    } else if ((year < 1926) || ((year == 1926) && ((month < 12) || ((month == 12) && (day <= 24))))) {
        printf("taisho %d %d %d\n", year - 1912 + 1, month, day);
    } else if ((year < 1989) || ((year == 1989) && ((month < 1) || ((month == 1) && (day <= 7))))) {
        printf("showa %d %d %d\n", year - 1926 + 1, month, day);
    } else {
        printf("heisei %d %d %d\n", year - 1989 + 1, month, day);
    }
}

int main(void)
{
    int year, month, day;
    scanf("%d %d %d", &year, &month, &day);
    while (((year >= 0) || (year <= 0)) && ((month >= 0) || (month <= 0)) && ((day >= 0) || (day <= 0))) {
        judge(year, month, day);
        scanf("%d %d %d", &year, &month, &day);
    }
    return 0;
}