#include<iostream>
using namespace std;

int main(){
    int y,m,d;
    long long a;
    while(cin>>y>>m>>d){
        a=d+100*m+10000*y;
        if(a<18680908)cout<<"pre-meiji"<<endl;
        else if(a>=18680908&&a<=19120729){
            cout<<"meiji "<<y-1867<<' '<<m<<' '<<d<<endl;
        }
        else if(a>=19120730&&a<=19261224){
            cout<<"taisho "<<y-1911<<' '<<m<<' '<<d<<endl;
        }
        else if(a>=19261225&&a<=19890107){
            cout<<"showa "<<y-1925<<' '<<m<<' '<<d<<endl;
        }
        else{
            cout<<"heisei "<<y-1988<<' '<<m<<' '<<d<<endl;
        }
    }
    return 0;
}