#include <stdio.h>

int meijiJ(int year, int month, int day);
int showaJ(int year, int month, int day);
int taishoJ(int year, int month, int day);
int heiseiJ(int year, int month, int day);

int main(void)
{
    int ye, mo, da;  //year, month, day
    while (scanf("%d %d %d", &ye, &mo, &da) != EOF) {
        if (meijiJ(ye, mo, da) != 4) {
            printf("pre-meiji\n");
        } else if (meijiJ(ye, mo, da) == 4 && taishoJ(ye, mo, da) != 8) {
            printf("meiji %d %d %d\n", ye - 1867, mo, da);
        } else if (taishoJ(ye, mo, da) == 8 && showaJ(ye, mo, da) != 12) {
            printf("taisho %d %d %d\n", ye - 1911, mo, da);
        } else if (showaJ(ye, mo, da) == 12 && heiseiJ(ye, mo, da) != 16) {
            printf("showa %d %d %d\n", ye - 1925, mo, da);
        } else {
            printf("heisei %d %d %d\n", ye - 1988, mo, da);
        }
    }
    return 0;
}

int meijiJ(int year, int month, int day)
{
    int result;
    if (year < 1868) {
        result = 1;  //1868??´??\???
    } else if (year == 1868) {
        if (month < 9) {
            result = 2;  //1868??´1?????????1868??´9?????\???
        } else if (month == 9 && day < 8) {
            result = 3;  //1868??´9???8??\??\???
        } else {
            result = 4; //????????\???
        }
    } else {
        result = 4;
    }
    return result;
}

int taishoJ(int year, int month, int day)
{
    int result;
    if (year < 1912) {
        result = 5;  //1912??´??\???
    } else if (year == 1912) {
        if (month < 7) {
            result = 6;  //1912??´1?????????1912??´7?????\???
        } else if (month == 7 && day < 30) {
            result = 7;  //1912??´7???1??\??????1912??´7???30??\??\???
        } else {
            result = 8; //??§??£??\???
        }
    } else {
        result = 8;
    }
    return result;
}

int showaJ(int year, int month, int day)
{
    int result;
    if (year < 1926) {
        result = 9;  //1926??´??\???
    } else if (year == 1926) {
        if (month < 12) {
            result = 10;  //1926??´1?????????1926??´12?????\???
        } else if (month == 12 && day < 25) {
            result = 11;  //1926??´12???1??\??????1926??´12???25??\??\???
        } else {
            result = 12; //????????\???
        }
    } else {
        result = 12;
    }
    return result;
}

int heiseiJ(int year, int month, int day)
{
    int result;
    if (year < 1989) {
        result = 13;  //1989??´??\???
    } else if (year == 1989) {
        if (month < 1) {
            result = 14;  //?§???????????????¢??°??¨??????????????¨????????????????????????
        } else if (month == 1 && day < 8) {
            result = 15;  //1989??´1???1??\??????1989??´1???8??\??\???
        } else {
            result = 16; //????????\???
        }
    } else {
        result = 16;
    }
    return result;
}