#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)
{
    if (year < 1868 || (year == 1868 && month < 9) || (year == 1868 && month == 9 && day < 8)) {
        printf("pre-meiji");
        return;
    }
    if ((year == 1868 && month == 9 && day >= 8) || (year == 1868 && month > 9)) {
        printf("meiji %d %d %d", year - 1867, month, day);
        return;
    }
    if (year > 1868 && year < 1912) {
        printf("meiji %d %d %d", year - 1867, month, day);
        return;
    }
    if ((year == 1912 && month < 7) || (year == 1912 && month == 7 && day <= 29)) {
        printf("meiji %d %d %d", year - 1867, month, day);
        return;
    }
    if ((year == 1912 && month == 7 && day >= 30) || (year == 1912 && month > 7)) {
        printf("taisyo %d %d %d", year - 1911, month, day);
        return;
    }
    if (year > 1912 && year < 1926) {
        printf("taisyo %d %d %d", year - 1911, month, day);
        return;
    }
    if ((year == 1926 && month < 12) || (year == 1926 && month == 12 && day <= 24)) {
        printf("taisyo %d %d %d", year - 1911, month, day);
        return;
    }
     if ((year == 1926 && month ==12 && day >= 25) || (year == 1926 && month > 12)) {
        printf("syowa %d %d %d", year - 1925, month, day);
        return;
    }
    if (year > 1926 && year < 1989) {
        printf("syowa %d %d %d", year - 1925, month, day);
        return;
    }
    if ((year == 1989 && month < 1) || (year == 1989 && month == 1 && day <= 7)) {
        printf("syowa %d %d %d", year - 1925, month, day);
        return;
    }
     if ((year == 1989 && month == 1 && day >= 8) || (year == 1989 && month > 1) || year > 1989) {
        printf("heisei %d %d %d", year - 1988, month, day);
        return;
    }
}