#include <stdio.h>
#include <stdbool.h>
bool Fmeiji, Ftaisho, Fshowa, Fheisei = false;
void meiji(int year,int month, int day);
void taisho(int year,int month, int day);
void showa(int year,int month, int day);
void heisei(int year,int month, int day);
int year, month, day;
int main(void)
{
    int wagou;
    while ((scanf("%d %d %d", &year , &month, &day)) != EOF) {
    heisei(year, month, day);
    if (Fheisei == true) {
        wagou = year - 1988;
        printf("heisei %d %d %d\n", wagou, month, day);
    } else {
        showa(year, month, day);
        if (Fshowa == true) {
            wagou = year - 1925;
            printf("showa %d %d %d\n", wagou, month, day);
        } else {
            taisho(year, month, day);
            if (Ftaisho == true) {
                wagou = year - 1911;
                printf("taisho %d %d %d\n", wagou, month, day);
            } else {
                meiji(year, month, day);
                if (Fmeiji == true) {
                    wagou = year - 1867;
                    printf("meiji %d %d %d\n", wagou, month, day);
                } else {
                    printf("pre-meiji\n");
                }
            }
        }
        
    }
    }
    return 0;
}

void meiji(int year, int month, int day)
{
    if(year > 1868) {
        Fmeiji =true;
    } else if (year == 1868 && month > 9) {
        Fmeiji = true;
    } else if (year == 1868 && month == 9 && day >= 8) {
        Fmeiji = true;
    } else {
        Fmeiji = false;
    }
}

void taisho(int year, int month, int day)
{
    if(year > 1912) {
        Ftaisho =true;
    } else if (year == 1912 && month > 7) {
        Ftaisho = true;
    } else if (year == 1912 && month == 7 && day >= 30) {
        Ftaisho = true;
    } else {
        Ftaisho = false;
    }
}

void showa(int year, int month, int day)
{
    if(year > 1926) {
        Fshowa =true;
    } else if (year == 1926 && month > 12) {
        Fshowa = true;
    } else if (year == 1926 && month == 12 && day >= 25) {
        Fshowa = true;
    } else {
        Fshowa = false;
    }
}

void heisei(int year, int month, int day)
{
    if(year > 1989) {
        Fheisei =true;
    } else if (year == 1989 && month > 1) {
        Fheisei = true;
    } else if (year == 1989 && month == 1 && day >= 8) {
        Fheisei = true;
    } else {
        Fheisei = false;
    }
}