#include <bits/stdc++.h>
using namespace std;
int main(void){
    int y,m,d,Y;
    while (cin>>y>>m>>d) {
        if ( (y>=1989&&m>=1&&d>=8)||(y>1990) ) {
            Y=y-1989+1;
            cout<<"heisei"<<" "<<Y<<" "<<m<<" "<<d<<endl;
        } else if ( (y>=1926&&m>=12&&d>=25)||(y>1927&&y<=1989) ) {
            Y=y-1926+1;
            cout<<"showa"<<" "<<Y<<" "<<m<<" "<<d<<endl;
        } else if ( (y>=1912&&m>=7&&d>=30)||(y>=1912&&m>8)||(y>1913&&y<=1926) ) {
            Y=y-1912+1;
            cout<<"taisho"<<" "<<Y<<" "<<m<<" "<<d<<endl;
        } else if ( (y>=1868&&m>=9&&d>=8)||(y>=1868&&m>10)||(y>1869&&y<=1912) ) {
            Y=y-1868+1;
            cout<<"meiji"<<" "<<Y<<" "<<m<<" "<<d<<endl;
        } else {
            cout<<"pre-meiji"<<endl;
        }
    }
}

