#include <iostream>
using namespace std;
int main(){
	const int ERA[4][3]={{1868,9,8},{1912,7,30},{1926,12,25},{1989,1,8}};
	const string ERA_N[]={"meiji","taisho","showa","heisei"};
	int y,m,d;
	while(cin>>y>>m>>d){
		if(ERA[0][0]>y||(ERA[0][0]==y&&ERA[0][1]>m)||(ERA[0][0]==y&&ERA[0][1]==m&&ERA[0][2]>d))cout<<"pre-meiji\n";
		else for(int i=3;i>=0;--i){
			if(ERA[i][0]<=y||(ERA[i][0]==y&&ERA[i][1]<=m)||(ERA[i][0]==y&&ERA[i][1]==m&&ERA[i][2]<=d)){
				int ly=y-ERA[i][0]+1;
				cout << ERA_N[i] << " " << ly << " " << m << " " << d << "\n";
				break;
			}
		}
	}
	return 0;
}