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

void heisei(int year, int month, int day);
void showa(int year, int month, int day);
void taisho(int year, int month, int day);
void meiji(int year, int month, int day);
void pre_meiji(void);
void era_name_transformer(int year, int month, int day);

int main(void)
{
    int year, month, day;

    while(scanf("%d %d %d", &year, &month, &day) != EOF) {
        era_name_transformer(year, month, day);
    }        
    return 0;
}

void era_name_transformer(int year, int month, int day)
{
    if (year > 1989) {
        heisei(year, month, day);
    } else if (year == 1989) {
        if (month > 1) {
            heisei(year, month, day);
        } else if (month == 1) {
            if (day >= 8) {
                heisei(year, month, day);        
            } else {
                showa(year, month, day);        
            }          
        }
    } else if (year > 1926) {
        showa(year, month, day);
    } else if (year == 1926) {
        if (month == 12) {
            if (day >= 25) {
                showa(year, month, day);     
            } else {
                taisho(year, month, day); 
            }          
        } else {
            taisho(year, month, day);
        }
    } else if (year > 1912){
        taisho(year, month, day);
    } else if (year == 1912) {
        if (month > 7) {
            taisho(year, month, day);
        } else if (month == 7) {
            if (day >= 30) {
                taisho(year, month, day);     
            } else {
                meiji(year, month, day); 
            }          
        } else {
            meiji(year, month, day);
        }
    } else if (year > 1868) {
        meiji(year, month, day);
    } else if (year == 1868) {
        if (month > 9) {
            meiji(year, month, day);
        } else if (month == 9) {
            if (day >= 8) {
                meiji(year, month, day);     
            } else {
                pre_meiji(); 
            }          
        } else {
            pre_meiji();
        }
    } else {
        pre_meiji();
    }
}

void heisei(int year, int month, int day)
{
    printf("heisei %d %d %d\n", year - 1988, month, day);
}

void showa(int year, int month, int day)
{
    printf("showa %d %d %d\n", year - 1925, month, day);
}

void taisho(int year, int month, int day)
{
    printf("taisho %d %d %d\n", year - 1911, month, day);
}

void meiji(int year, int month, int day)
{
    printf("meiji %d %d %d\n", year - 1867, month, day);
}

void pre_meiji(void)
{
    printf("pre-meiji\n");
}