#include<iostream>
using namespace std;
int main()
{
	int y,m,d;
	while(cin>>y>>m>>d) 
	{
		int n=y*10000+m*100+d;
		if(n<=1868*10000+9*100+7) cout<<"pre-meiji"<<endl;
		else if(n<=1912*10000+7*100+29) cout<<"meiji"<<" "<<y-1868+1<<" "<<m<<" "<<d<<endl;
		else if(n<=1926*10000+12*100+24) cout<<"taisho"<<" "<<y-1912+1<<" "<<m<<" "<<d<<endl;
		else if(n<=1989*10000+1*100+7) cout<<"showa"<<" "<<y-1926+1<<" "<<m<<" "<<d<<endl;
		else cout<<"heisei"<<" "<<y-1989+1<<" "<<m<<" "<<d<<endl;
	}
  return 0;
}