#include <iostream>
using namespace std;
int main(void){int y,m,d;int a[4]={18680908,19120730,19261225,19890108};int b[4]={1868,1912,1926,1989};char c[4][9]={"meiji","taisho","showa","heisei"};while(cin>>y>>m>>d){int j=10000*y+100*m+d;if(j<a[0]){cout<<"pre-meiji"<<endl;}if(j>=a[3]){printf("%s %d %d %d\n",c[3],y-b[3]+1,m,d);}else{for(int i=0;i<3;i++){if(a[i]<= j&&j<a[i+1]){printf("%s %d %d %d\n",c[i],y-b[i]+1,m,d);break;}}}}return 0;}