#include<iostream>
#include<string>
using namespace std;
int main(){
  string name[5]={"meiji","taisho","showa","heisei"},ss=" ";
  int year[5]={1867,1911,1925,1988};
  int a,b,c,d;
  while(cin>>a>>b>>c){
    d=a*10000+b*100+c;
    if(d<18680908){cout<<"pre-meiji"<<endl;continue;}
    if(d<19120730){cout<<"meiji"<<ss<<a-1867<<ss<<b<<ss<<c<<endl;continue;}
    if(d<19261225){cout<<"taisho"<<ss<<a-1911<<ss<<b<<ss<<c<<endl;continue;}
    if(d<19890108){cout<<"showa"<<ss<<a-1925<<ss<<b<<ss<<c<<endl;continue;}
    cout<<"heisei"<<ss<<a-1988<<ss<<b<<ss<<c<<endl;
  }
  return 0;
}