#include <stdio.h>
#include <stdbool.h>

bool judge_beginning_era(int year, int month, int day, int beginning_year, int beginning_month, int beginning_day)
{
    if (beginning_year < year || (beginning_year == year && (beginning_month < month || (beginning_month == month && beginning_day <= day)))) {
        return true;
    } else {
        return false;
    }
} //元号の始まり以後かどうか

bool judge_end_era(int year, int month, int day, int end_year, int end_month, int end_day)
{
    if (year < end_year || (end_year == year && (month < end_month || (month == end_month && day <= end_day)))) {
        return true;
    } else {
        return false;
    }
} //元号の終わり以前かどうか

int main(void)
{
    while (1) {
        int year;
        int month;
        int day;
        scanf("%d %d %d", &year, &month, &day);
        if (year == EOF && month == EOF && day == EOF) {
            return 0;
        } else {
            if (judge_end_era(year, month, day, 1868, 9, 8)) {
                printf("pre-meiji\n");
            } else if (judge_beginning_era(year, month, day, 1868, 9, 8) == true  && judge_end_era(year, month, day, 1912, 7, 29) == true) {
                printf("meiji %d %d %d\n", year - 1868 + 1, month, day);
            } else if (judge_beginning_era(year, month, day, 1912, 7, 30) == true && judge_end_era(year, month, day, 1926, 12, 24) == true) {
                printf("taisho %d %d %d\n", year-1912 + 1, month, day);
            } else if (judge_beginning_era(year, month, day, 1926, 12, 25) == true && judge_end_era(year, month, day, 1989, 1, 7) == true) {
                printf("shouwa %d %d %d\n", year - 1926 + 1, month, day);
            } else {
                printf("heisei %d %d %d\n", year - 1989 + 1, month, day);
            }
        }
    }
}

/*meiji	1868. 9. 8 〜 1912. 7.29
taisho	1912. 7.30 〜 1926.12.24
showa	1926.12.25 〜 1989. 1. 7
heisei	1989. 1. 8 〜*/