#include <bits/stdc++.h>
using namespace std;
int main(){
	string data[6]={"pre-meiji","meiji","taisho","showa","heisei"};
	int year[5]={18680908,19120730,19261225,19890108};
	bool f[5];
	int y,m,d;
	while(cin>>y>>m>>d){
		int date=y*10000+m*100+d;
		if(date<year[0]){
			cout<<data[0]<<endl;
		}else{
			for(int i=1;i<=3;i++){
				if(year[i-1]<=date&&date<year[i]){
					cout<<data[i]<<" "<<y-(year[i-1]/10000)+1<<" "<<m<<" "<<d<<endl;
				}
			}
			if(date>=year[3])cout<<data[4]<<" "<<y-(year[3]/10000)+1<<" "<<m<<" "<<d<<endl;
		}
	}
}