#include<iostream>
#define f(A,B,C)Y<A||Y==A&&M<B||Y==A&&M==B&&D<C
using namespace std;
int Y,M,D;
main()
{
	while(cin>>Y>>M>>D)
	{
		if(f(1868,9,8))cout<<"pre-meiji"<<endl;
		else if(f(1912,7,30))cout<<"meiji "<<Y-1867<<" "<<M<<" "<<D<<endl;
		else if(f(1926,12,25))cout<<"taisho "<<Y-1911<<" "<<M<<" "<<D<<endl;
		else if(f(1989,1,8))cout<<"showa "<<Y-1925<<" "<<M<<" "<<D<<endl;
		else cout<<"heisei "<<Y-1988<<" "<<M<<" "<<D<<endl;
	}
}

