#include<iostream>
#include<cstdio>
main(){int a,b,c,d;while(std::cin>>a>>b>>c){d=a*10000+b*100+c;if(d<18680908){printf("pre-meiji\n");continue;}if(d<19120730){printf("meiji %d %d %d\n",a-1867,b,c);continue;}if(d<19261225){printf("taisho %d %d %d\n",a-1911,b,c);continue;}if(d<19890108){printf("showa %d %d %d\n",a-1925,b,c);continue;}printf("heisei %d %d %d\n",a-1988,b,c);}}