#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

struct Day{
	int y,m,d;
	Day(){}
	Day(int y,int m,int d):y(y),m(m),d(d){}
	bool operator<=(Day a){
		if(y!=a.y)return y<a.y;
		if(m!=a.m)return m<a.m;
		return d<=a.d;
	}
};

int main(){
	int y,m,d;
	char *gengo[]={"heisei","showa","taisho","meiji"};
	Day begin[4]={Day(1989,1,8),Day(1926,12,25),Day(1912,7,30),Day(1868,9,8)};
	while(cin>>y>>m>>d){
		int i;
		Day day(y,m,d);
		for(i=0;i<4;i++){
			if(begin[i]<=day){
				day.y -= begin[i].y-1;
				break;
			}
		}
		if(i==4)cout<<"pre-meiji\n";
		else cout<<gengo[i]<<' '<<day.y<<' '<<day.m<<' '<<day.d<<endl;
	}
	return 0;
}