#include<iostream>
using namespace std;
int main(){
  int a,b,c;
  while(cin >>a>>b>>c){
    long int x=c+b*100+a*10000;
    if(x<18680908) cout <<"pre-meiji"<<endl;
    else if(x<19120730) cout<<"meiji"<<" "<<a-1868+1<<" "<<b<<" "<<c<<endl;
    else if(x<19261225) cout<<"taisho"<<" "<<a-1912+1<<" "<<b<<" "<<c<<endl;
    else if(x<19890108) cout<<"showa"<<" "<<a-1926+1<<" "<<b<<" "<<c<<endl;
    else cout<<"heisei"<<" "<<a-1989+1<<" "<<b<<" "<<c<<endl;
  }
  return 0;
}