#include <stdio.h>

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

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

void era_name(int year, int month, int day)
{
    int myear = year - 1867;
    int tyear = year - 1911;
    int syear = year - 1925;
    int hyear = year - 1988;
    int date = year * 10000 + month * 100 + day;
    if (date <= 18680907) {
        printf("pre-meiji\n");
    } else if (date <= 19120729) {
        printf("meiji %d %d %d\n", myear, month, day);
    } else if (date <= 19261224) {
        printf("taisho %d %d %d\n", tyear, month,day);
    } else if (date <= 19890107) {
        printf("showa %d %d %d\n", syear, month, day);
    } else {
        printf("heisei %d %d %d\n", hyear, month, day);
    }
}