#include <stdio.h>

typedef enum
{
    MEIJI, TAISHO, SHOWA, HEISEI, PREMEIJI
}Era_name;

Era_name judge_era_name(int year, int month, int day);

int main()
{
    int year, month, day;
    Era_name era_name;

    while (true) {
        if (scanf("%d %d %d", &year, &month, &day) == EOF) {
            break;
        } else {
            era_name = judge_era_name(year, month, day);
            switch (era_name) {
                case MEIJI:
                    printf("meiji %d %d %d\n", year - 1867, month, day);
                    break;
                case TAISHO:
                    printf("taisho %d %d %d\n", year - 1911, month, day);
                    break;
                case SHOWA:
                    printf("showa %d %d %d\n", year - 1926, month, day);
                    break;
                case HEISEI:
                    printf("heisei %d %d %d\n", year - 1988, month, day);
                    break;
                case PREMEIJI:
                    printf("pre-meiji\n");
                    break;
                default:
                    break;
            }
        }
    }
    return 0;
}

Era_name judge_era_name(int year, int month, int day)
{
    if (year < 1868) {
        return PREMEIJI;
    }
    if (year == 1868) {
        if (month < 9) {
            return PREMEIJI;
        } else if (month == 9) {
            if (day < 8) {
                return PREMEIJI;
            } else {
                return MEIJI;
            }
        } else {
            return MEIJI;
        }

    }
    if (year > 1868 && year < 1912) {
        return MEIJI;
    }
    if (year == 1912) {
        if (month < 7) {
            return MEIJI;
        } else if (month == 7) {
            if (day < 30) {
                return MEIJI;
            } else {
                return TAISHO;
            }
        } else {
            return TAISHO;
        }
    }
    if (year > 1912 && year < 1926) {
        return TAISHO;
    }
    if (year == 1926) {
        if (month < 12) {
            return TAISHO;
        } else if (month == 12) {
            if (day < 25) {
                return TAISHO;
            } else {
                return SHOWA;
            }
        } else {
            return SHOWA;
        }
    }
    if (year > 1926 && year < 1989) {
        return SHOWA;
    }
    if (year == 1989) {
        if (month < 1) {
            return SHOWA;
        } else if (month == 1) {
            if (day < 8) {
                return SHOWA;
            } else {
                return HEISEI;
            }
        } else {
            return HEISEI;
        }
    }
    if (year > 1989) {
        return HEISEI;
    }
}