#include <stdio.h>

int main(void)
{
    int y, m, d;
    while(1){
        scanf("%d %d %d", &y, &m, &d);
        if (scanf("%d %d %d", &y, &m, &d) == EOF){
            break;
        }
        if((y < 1868)||(y == 1868 && m < 9)||(y == 1868 && m == 9 && d < 8)){
            printf("pre-meiji");
        }else if((y < 1912)||(y == 1912 && m < 7)||(y == 1912 && m == 7 && d < 30)){
            printf("meiji %d %d %d\n", y+1-1868, m, d);
        }else if((y < 1926)||(y == 1926 && m < 12)||(y == 1926 && m == 12 && d < 15)){
            printf("taisho %d %d %d\n", y+1-1912, m, d);
        }else if((y < 1989)||(y == 1989 && m < 1)||(y == 1989 && m == 1 && d < 8)){
            printf("showa %d %d %d\n", y+1-1926, m, d);
        }else{
            printf("heisei %d %d %d\n", y+1-1989, m, d);
        }
    }
    return 0;
}
        
    