#include <stdio.h>
 
int year, month, day, sum;

int print(void);

int main(void)
{
    while(scanf("%d %d %d", &year, &month, &day) != EOF) {
    sum = 10000 * year+ 100 * month + day;
    print();
    }
    return 0;
}

int print(void)
{
    if (sum < 18680907) {
        printf("pre-meiji\n");
    } else if (sum < 19120730) {
        printf("meiji %d %d %d\n", year - 1867, month, day);
    } else if (sum < 19261225) {
        printf("taisho %d %d %d\n", year - 1911, month, day);
    } else if (sum < 19890108) {
        printf("showa %d %d %d\n", year - 1925, month, day);
    } else {
        printf("heisei %d %d %d\n", year - 1988, month, day);
    }
}