#include <iostream>
#include <string>
using namespace std;

int main(){
  int y,m,d,dd;
  string me="meiji",t="taisho",s="showa",h="heisei";
  while(cin>>y>>m>>d){
    dd=m*31+d;
    if(y>=1989){
      if(y==1989&&dd>=39){
	cout<<h<<" "<<"1"<<" "<<m<<" "<<d<<endl;
      }else if(y>1989)cout<<h<<" "<<y-1989+1<<" "<<m<<" "<<d<<endl;
    }else if(y>=1926){
      if(y==1926&&dd>=676){
	cout<<s<<" "<<"1"<<" "<<m<<" "<<d<<endl;
      }else if(y>1926)cout<<s<<" "<<y-1926+1<<" "<<m<<" "<<d<<endl;
    }else if(y>=1912){
      if(y==1912&&dd>=247){
	cout<<t<<" "<<"1"<<" "<<m<<" "<<d<<endl;
      }else if(y>1912)cout<<t<<" "<<y-1912+1<<" "<<m<<" "<<d<<endl;
    }else if(y>=1868){
      if(y==1868&&dd>=287){
	cout<<me<<" "<<"1"<<" "<<m<<" "<<d<<endl;
      }else if(y>1868){
	cout<<me<<" "<<y-1868+1<<" "<<m<<" "<<d<<endl;
      }else cout<<"pre-meiji"<<endl; 
    }else cout<<"pre-meiji"<<endl; 
  }
  return 0;
}