#include <stdio.h>

void seireki2wareki(int year_west, int month, int day);

int main(void)
{
    int year_west, month, day;
    while ((scanf("%d %d %d", &year_west, &month, &day)) != EOF){
        seireki2wareki(year_west, month, day);
    }

    return 0;
}

void seireki2wareki(int year_west, int month, int day)
{
    enum {PRE, MEIJI, TAISHO, SHOWA, HEISEI} gengou;
    int year_ja;

    if (year_west < 1868){
        gengou = PRE;
    } else if (year_west == 1868){
        if (month < 9){
            gengou = PRE;
        } else if (month == 9){
            if (day < 8){
                gengou = PRE; // pre_meiji ここまで
            } else {
                gengou = MEIJI;
                year_ja = 1;
            }
        } else {
            gengou = MEIJI;
            year_ja = 1;
        }
    } else if (year_west < 1912){
        gengou = MEIJI;
        year_ja = year_west - 1868 + 1;
    } else if (year_west == 1912){
        if (month < 7){
            gengou = MEIJI;
            year_ja = year_west - 1868 + 1;
        } else if (month == 7){
            if (day < 30){
                gengou = MEIJI;
                year_ja = year_west - 1868 + 1; // meiji ここまで
            } else {
                gengou = TAISHO;
                year_ja = 1;
            }
        } else {
            gengou = TAISHO;
            year_ja = 1;
        }
    } else if (year_west < 1926){
        gengou = TAISHO;
        year_ja = year_west - 1912 + 1;
    } else if (year_west == 1926){
        if (month < 12){
            gengou = TAISHO;
            year_ja = year_west - 1912 + 1;
        } else {
            if (day < 25){
                gengou = TAISHO;
                year_ja = year_west - 1912 + 1; // taisho ここまで
            } else {
                gengou = SHOWA;
                year_ja = 1;
            }
        }
    } else if (year_west < 1989){
        gengou = SHOWA;
        year_ja = year_west - 1926 + 1;
    } else if (year_west == 1989){
        if (month == 1){
            if (day < 8){
                gengou = SHOWA;
                year_ja = year_west - 1926 + 1; // showa ここまで
            } else {
                gengou = HEISEI;
                year_ja = 1;
            }
        } else {
            gengou = HEISEI;
            year_ja = 1;
        }
    } else {
        gengou = HEISEI;
        year_ja = year_west - 1989 + 1;
    }

    switch (gengou){
        case PRE:
            printf("pre-meiji\n");
            break;
        case MEIJI:
            printf("meiji ");
            break;
        case TAISHO:
            printf("taisho ");
            break;
        case SHOWA:
            printf("showa ");
            break;
        case HEISEI:
            printf("heisei ");
            break;
    }
    if (gengou != PRE){
        printf("%d %d %d\n", year_ja, month, day);
    }
}