#include<cstdio>
using namespace std;
int main(){
    int y,m,d;
    while(scanf("%d%d%d",&y,&m,&d) != EOF){
        if(y <= 1868 && m <= 9 && d <= 7){
            printf("pre-meiji\n");
            continue;
        }
        if(y == 1989 && m == 1 && d >= 8 || y > 1989){
            y -= 1988;
            printf("heisei %d %d %d\n",y,m,d);
        }
        else if(y == 1926 && m == 12 && d >= 25 || y > 1926){
            y -= 1925;
            printf("showa %d %d %d\n",y,m,d);
        }
        else if(y == 1912 && m == 7 && d >= 30 || y == 1912 && m >= 8 || y > 1912){
            y -= 1911;
            printf("taisho %d %d %d\n",y,m,d);
        }
        else if(y == 1868 && m == 9 && d >= 8 || y == 1868 && m >= 10 || y > 1868){
            y -= 1867;
            printf("meiji %d %d %d\n",y,m,d);
        }
    }
    return 0;
}