#include <stdio.h>

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

int main(void)
{
    int year;
    int month;
    int day;
    scanf("%d %d %d", &year, &month, &day);
    while (year != EOF) {
        era_name(year, month, day);
        printf("\n");
        scanf("%d %d %d", &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");
    } else if (date <= 19120729) {
        printf("meiji %d %d %d", myear, month, day);
    } else if (date <= 19261224) {
        printf("taisyo %d %d %d", tyear, month,day);
    } else if (date <= 19890107) {
        printf("syowa %d %d %d", syear, month, day);
    } else {
        printf("heisei %d %d %d", hyear, month, day);
    }
}