#include<iostream>
using namespace std;

int y,m,d;
bool b(int a,int b,int c){
    return (y<a||(y==a&&m<b)||(y==a&&m==b&&d<c));
}
int main(){
    while(cin>>y>>m>>d){
        if(b(1868,9,8))
            cout<<"pre-meiji"<<endl;
        else if(b(1912,7,30))
            cout<<"meiji "<<(y-1867)<<" "<<m<<" "<<d<<endl;
        else if(b(1926,12,25))
            cout<<"taisho "<<(y-1911)<<" "<<m<<" "<<d<<endl;
        else if(b(1989,1,8))
            cout<<"showa "<<(y-1925)<<" "<<m<<" "<<d<<endl;
        else cout<<"heisei "<<(y-1988)<<" "<<m<<" "<<d<<endl;
    }
}