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

int main(void)
{
    int year, month, day, gengo;
    bool flag = true;
    while ((scanf("%d %d %d", &year, &month, &day)) != EOF) {
        if ((year < 1868) || ((year == 1868 && (month < 9)) || (year == 1868 &&(month == 9 && day < 8)))) {
            printf("pre-meiji");
        } else //if ((year > 1868) || ((year == 1868) && ((month > 9) || ((month == 9) && (day >= 8))))) {
            if ((year < 1912) || ((year == 1912 && (month < 7)) || (year == 1912 &&(month == 7 && day < 30)))) {
                gengo = year - 1867;
                printf("meiji %d %d %d\n", gengo, month, day);
            } else if ((year < 1926) || ((year == 1926 && (month < 12)) || (year == 1926 &&(month == 12 && day < 25)))) {
                gengo = year - 1911;
                printf("taisho %d %d %d\n", gengo, month, day);
            } else if ((year < 1989) || ((year == 1989 && (month < 1)) || (year == 1989 &&(month == 1 && day < 8)))) {
                gengo = year - 1925;
                printf("showa %d %d %d\n", gengo, month, day);
            } else {
                gengo = year - 1988;
                printf("heisei %d %d %d\n", gengo, month, day);
            }
    }
    return 0;
}