#include<stdio.h>
int main(void)
{
	int y,m,d;
	while(scanf("%d%d%d",&y,&m,&d)>0)
	{
		if(y<1868 ||
			(y==1868&&m<9) ||
			(y==1868&&m==9&&d<=7) )
			printf("pre-meiji\n");
		else if(y<1912 ||
			y==1912&&m<7 ||
			y==1912&&m==7&&d<=29)
			printf("meiji %d %d %d\n",y-1868+1,m,d);
		else if(y<1926 ||
			y==1926&&m<12 ||
			y==1926&&m==12&&d<=24)
			printf("taisho %d %d %d\n",y-1912+1,m,d);
		else if(y<1989 ||
			y==1989&&m==1&&d<=7)
			printf("showa %d %d %d\n",y-1926+1,m,d);
		else
			printf("heisei %d %d %d\n",y-1989+1,m,d);
	}
	return 0;
}