#include<iostream>
using namespace std;
int main()
{
  int y,m,d;
  long long int t;
  for(;cin>>y>>m>>d;)
    {
      string n="meiji";
      t=y*365+m*12+d;
      y-=1867;
      if(t>697993)
	n="taisho",y-=44;
      if(t>703158)
	n="showa",y-=14;
      if(t>726004)
	n="heisei",y-=63; 
      if(t<681936)
	cout<<"pre-meiji"<<endl;
      else
	cout<<n<<" "<<y<<" "<<m<<" "<<d<<endl;
    }
}