#include<iostream>
using namespace std;

#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)

int main(){
	int y,m,d;
	while(cin>>y>>m>>d){
		int num=y*100*100+m*100+d;
		if(num<18680908)cout<<"pre-meiji";
		else if(num<19120730)cout<<"meiji "<<y-1867<<" "<<m<<" "<<d;
		else if(num<19261225)cout<<"taisho "<<y-1911<<" "<<m<<" "<<d;
		else if(num<19890108)cout<<"showa "<<y-1925<<" "<<m<<" "<<d;
		else cout<<"heisei "<<y-1988<<" "<<m<<" "<<d;
		cout<<endl;
		
	}
}