#include <bits/stdc++.h>
using namespace std;
int Date(int y,int m,int d){
	return y*10000+m*100+d;
}
int main(){
	string data[6]={"pre-meiji","meiji","taisho","showa","heisei"};
	int year[5]={0,1868,1912,1926,1989};
	bool f[5];
	int y,m,d;
	while(cin>>y>>m>>d){
		memset(f,false,sizeof(f));
		int date=Date(y,m,d);
		if(date<Date(1868,9,8))f[0]=true;
		else if(Date(1868,9,8)<=date&&date<Date(1912,7,29))f[1]=true;
		else if(Date(1912,7,29)<=date&&date<Date(1926,12,24))f[2]=true;
		else if(Date(1926,12,24)<=date&&date<Date(1989,1,7))f[3]=true;
		else if(Date(1989,1,7)<=date&&Date(1989,1,8)<=date)f[4]=true;
		if(f[0]){
			cout<<"pre-meiji"<<endl;
			return 0;
		}else{
			for(int i=1;i<5;i++){
				if(f[i]){
					cout<<data[i]<<" "<<y-year[i]+1<<" "<<m<<" "<<d<<endl;
				}
			}
		}
	}
}