#include<stdio.h>

int main(){
int x,y,z;
int n1=0,m1=0;

while(scanf("%d %d %d",&x,&y,&z)!=EOF){
n1=10000*x+100*y+z;
if(n1>=19890108){printf("heisei ");x=x-1988;}
else if(n1>=19261225){printf("showa ");x=x-1925;}
else if(n1>=19120730){printf("taisho ");x=x-1911;}
else if(n1>=18680908){printf("meiji ");x=x-1985;}
else if(n1<18680908)printf("pre-meiji\n");

if(n1>=18680908)printf("%d %d %d\n",x,y,z);
n1=0;
}
return 0;
}