#include <stdio.h>

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

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

void era_name(int year, int month, int date)
{
    int meiji_year = year - 1868 +1;
    int taisho_year = year - 1912 + 1;
    int showa_year = year - 1926 + 1;
    int heisei_year = year - 1989 + 1;
    if (year > 1989 || (year == 1989 && month > 1) || (year == 1989 && month == 1 && date >= 8)) {       //1989.1.8〜は平成
        printf("heisei %d %d %d\n", heisei_year, month, date);
    } else if (year > 1926 || (year == 1926 && month == 12 && date >= 25)) {      //1926.12.25〜1989.1.7は昭和
        printf("showa %d %d %d\n", showa_year, month, date);
    } else if (year > 1912 || (year == 1912 && month > 7) || (year == 1912 && month == 7 && date >= 30)) {      //1912.7.30〜1926.12.24は大正      
        printf("taisho %d %d %d\n", taisho_year, month, date);
    } else if (year > 1868 || (year == 1868 && month > 9) || (year == 1868 && month == 9 && date >= 8)) {      //1868.9.8〜1912.7.29は明治
        printf("meiji %d %d %d\n", meiji_year, month, date);
    } else {
        printf("pre-meiji\n");
    }
}