#include <stdio.h>
#include <stdbool.h>
 
void judge(int ye, int mo, int da)
{
    int sum = 10000 * ye + 100 * mo + da;
    if (sum < 18680908) {
        printf("pre-meiji\n");
    } else if (sum < 19120730) {
        printf("meiji %d %d %d\n", x - 1867, y, z);
    } else if (sum < 19261225) {
        printf("taisho %d %d %d\n", x - 1911, y, z);
    } else if (sum < 19890108) {
        printf("showa %d %d %d\n", x - 1925, y, z);
    } else {
        printf("heisei %d %d %d\n", x - 1988, y, z);
    }
}
    
    
void main(void)
{
    int ye, mo, da;
    scanf ("%d%d%d", &ye, &mo, &da);
    while (scanf ("%d%d%d", &ye, &mo, &da) != EOF) {   
        judge(ye, mo, da);
    }
}