#include <iostream>
using namespace std;
int main(void)
{
	int y,m,d;
	int ymd[4]={18680908,19120730,19261225,19890108};
	int year[4]={1868,1912,1926,1989};
	char gengou[4][10]={"meiji","taisho","showa","heisei"};
	while(cin >> y >> m >> d){
		int judge = 10000*y +100*m + d;
		if(judge<ymd[0]){
			cout << "pre-meiji" << endl;
		}if(judge>=ymd[3]){
			printf("%s %d %d %d\n",gengou[3],y-year[3]+1,m,d);
		}else{
			for(int i= 0; i < 3; i++){
				if(ymd[i] <= judge && judge < ymd[i+1]){
					printf("%s %d %d %d\n",gengou[i],y-year[i]+1,m,d);
					break;
				}
			}
		}
	}
	return 0;
}