#include <stdio.h>

const int MEIJI_BEGIN = 18680908;//各年号の設定
const int MEIJI_BEGIN_YEAR = 1868;
const int TAISHO_BEGIN = 19120730;
const int TAISHO_BEGIN_YEAR = 1912;
const int SHOWA_BEGIN = 19261225;
const int SHOWA_BEGIN_YEAR = 1926;
const int HEISEI_BEGIN = 19890108;
const int HEISEI_BEGIN_YEAR = 1989;

int judge_era(int era, int year, int month, int day);//年号の判定

void transform_year(int begin_year, int *year);//西暦→和暦への変換

int main(void)
{
    int year, month, day;
    while (scanf("%d %d %d", &year, &month, &day) != EOF) {     
        if (judge_era(HEISEI_BEGIN, year, month, day) == 1) {//平成かの判定
            transform_year(HEISEI_BEGIN_YEAR, &year);
            printf("heisei %d %d %d\n", year, month, day);
        } else if (judge_era(SHOWA_BEGIN, year, month, day) == 1) {//昭和かの判定
            transform_year(SHOWA_BEGIN_YEAR, &year);
            printf("showa %d %d %d\n", year, month, day);
        } else if (judge_era(TAISHO_BEGIN, year, month, day) == 1) {//大正かの判定
            transform_year(TAISHO_BEGIN_YEAR, &year);
            printf("taisho %d %d %d\n", year, month, day);
        } else if (judge_era(MEIJI_BEGIN, year, month, day) == 1) {//明治かの判定
            transform_year(MEIJI_BEGIN_YEAR, &year);
            printf("meiji %d %d %d\n", year, month, day);
        } else {
            printf("pre-meiji\n");
        }
    }
    return 0;
}

int judge_era(int era, int year, int month, int day)
{
    if (era <= year * 10000 + month * 100 + day) {
        return 1;
    } else {
        return 0;
    }
}

void transform_year(int begin_year, int *year)
{
    *year = *year - begin_year + 1;
    return;
}