#include<iostream>
using namespace std;
int main(){
long y,m,d;
while(cin>>y){
cin>>m>>d;
if(y<1868){cout<<"pre-meiji"<<endl;continue;}
else if(y==1868){
if(m>10)cout<<"meiji 1";
else if(m==9&&d>7)cout<<"meiji 1";
else{cout<<"pre-meiji"<<endl;continue;}
}
else if(y<1912)cout<<"meiji "<<y-1867;
else if(y==1912){
if(m<7)cout<<"meiji 45";
else if(m>7)cout<<"taisho 1";
else{if(d<30)cout<<"meiji 45";else cout<<"taisho 1";}
}
else if(y<1926)cout<<"taisho "<<y-1911;
else if(y==1926){
if(m<12)cout<<"taisho 15";
else{if(d<25)cout<<"taisho 15";else cout<<"showa 1";}
}
else if(y<1989)cout<<"showa "<<y-1925;
else if(y==1989){
if(m==1){if(d<8)cout<<"showa 64";else cout<<"heisei 1";}
else cout<<"heisei 1";
}
else cout<<"heisei "<<y-1988;
cout<<" "<<m<<" "<<d<<endl;
}
return 0;
}