#include<stdio.h>

int main(){
	int a,b,c;
	while(~scanf("%d%d%d",&a,&b,&c)){
		if(a<1868||a==1868&&(b<9||(b==9&&c<8)))printf("pre-meiji\n");
		else if(a<1912||a==1912&&(b<7||(b==7&&c<30)))printf("meiji %d %d %d\n",a-1867,b,c);
		else if(a<1926||a==1926&&(b<12||(b==12&&c<25)))printf("taisho %d %d %d\n",a-1911,b,c);
		else if(a<1989||a==1989&&(b<1||(b==1&&c<8)))printf("showa %d %d %d\n",a-1925,b,c);
		else printf("heisei %d %d %d\n",a-1988,b,c);
	}
}