#include<cstdio>
using namespace std;
int main(void)
{
	int y,m,d,i,j,x,d1[4],y2;
	int yy[4]={1868,1912,1926,1989},mm[4]={9,7,12,1},dd[4]={8,30,25,8};
	for(i=0;i<4;i++)	{
		d1[i]=yy[i]*10000+mm[i]*100+dd[i];
	}
	while(scanf("%d %d %d",&y,&m,&d)!=EOF)	{
		x=y*10000+m*100+d;
		if(x<d1[0])	{
			printf("pre-meiji\n");
		}
		else if(x<d1[1])	{
			y2=y-yy[0]+1;
			printf("meiji %d %d %d\n",y2,m,d);
		}
		else if(x<d1[2])	{
			y2=y-yy[1]+1;
			printf("taisho %d %d %d\n",y2,m,d);
		}
		else if(x<d1[3])	{
			y2=y-yy[2]+1;
			printf("showa %d %d %d\n",y2,m,d);
		}
		else {
			y2=y-yy[3]+1;
			printf("heisei %d %d %d\n",y2,m,d);
		}
	}
	return 0;
}
