#include <stdio.h>

int main(void){
	int y, m, d;
	char ans[256];
	while(scanf("%d%d%d",&y,&m,&d) != EOF){
		if(y < 1868 || (y == 1868 && m < 9) || (y == 1868 && m == 9 && d < 8)){
			sprintf(ans,"pre-meiji");
		}else if(y < 1912 || (y == 1912 && m < 7) || (y == 1912 && m == 7 && d < 30)){
			sprintf(ans,"meiji %d %d %d",y - 1867,m,d);
		}else if(y < 1926 || (y == 1926 && m < 12) || (y == 1926 && m == 12 && d < 25)){
			sprintf(ans,"taisho %d %d %d",y - 1911,m,d);
		}else if(y < 1989 || (y == 1989 && m == 1 && d < 8)){
			sprintf(ans,"showa %d %d %d",y - 1925,m,d);
		}else{
			sprintf(ans,"heisei %d %d %d",y - 1988,m,d);
		}
		puts(ans);
	}
	return 0;
}