//46
#include<iostream>
#include<algorithm>

using namespace std;

int fm(int y,int m,int d){
  return y*10000+m*100+d;
}

int main(){
  int year[]={1868,1912,1926,1989};
  int t[4]={fm(1868,9,8),fm(1912,7,30),fm(1926,12,25),fm(1989,1,8)};
  const char *s[]={"pre-meiji","meiji","taisho","showa","heisei"};
  for(int y,m,d;cin>>y>>m>>d;){
    int r=upper_bound(t,t+4,fm(y,m,d))-t;
    cout<<s[r];
    if(r>0){
      cout<<' '<<y-year[r-1]+1<<' '<<m<<' '<<d;
    }
    cout<<endl;
  }
  return 0;
}