#include <stdio.h>

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

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

void era(int year, int month, int day)
{
    int count = year * 10000 + month * 100 + day;
    if (count < 18680908) {
        printf("pre-meiji\n");
    } else if (count < 19120730) {
        printf("meiji %d %d %d\n", year - 1867, month, day);
    } else if (count < 19261225) {
        printf("taisho %d %d %d\n", year- 1911, month, day);
    } else if (count < 19890108) {
        printf("showa %d %d %d\n", year - 1925, month, day); 
    } else {
        printf("heisei %d %d %d\n", year - 1988, month, day);
    }
}