#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>1912*365+7*12+29)
        n="taisho",y-=44;
      if(t>1926*365+12*12+24)
        n="showa",y-=14;
      if(t>1989*365+1*12+7)
        n="heisei",y-=63; 
      if(t<1868*365+9*12+8)
        cout<<"pre-meiji"<<endl;
      else
        cout<<n<<" "<<y<<" "<<m<<" "<<d<<endl;
    }
}