#include<stdio.h>

void name_transformation(int year, int month, int day);

int main(void)
{
    while(1){
        int a, b, c; /*aは年、bは月、cは日を表す*/
        scanf("%d %d %d", &a, &b, &c);
        if (a == EOF){
            break;
        }else{
            name_transformation(a, b, c);
        }
    }
    return 0;
}

void name_transformation(int year, int month,int day)
{   
    int gengou; 
    if (year >= 1989 && ( (month >= 1 && day >= 8) || month >= 2 )){/*平成*/
        gengou = year - 1989 + 1;
        printf("heisei %d %d %d\n", gengou, month, day);
    }else if( year == 1989){/*昭和*/
        printf("showa 64 %d %d\n", month, day);
    }else if (year < 1989 && ( year > 1926 || (year == 1926 && month == 12 && day >= 25))){
        gengou = year - 1926 + 1;
        printf("showa %d %d %d\n", gengou, month, day);
    }else if (year == 1926){
        printf("taisho 15 %d %d\n", month, day);
    }else if ( year < 1926 && ( year > 1912 || ( year == 1912 && ( month > 7 || ( month == 7 && day >= 30 ))))){
        gengou = year - 1912 + 1;
        printf("taisho %d %d %d\n", gengou, month, day);
    }else if (year == 1912){
        printf("meiji 45 %d %d\n", month, day);
    }else if (year < 1912 && ( year > 1868 || (year == 1868 && (month > 9 || (month == 9 && day >= 8))))){
        gengou = year - 1868 + 1;
        printf("meiji %d %d %d\n", gengou, month, day);
    }else{
        printf("pre-meiji\n");
    }
}
        
    

            
           