#include <iostream>
using namespace std;

int main()
{
	int y,m,d,t;
	while(cin >> y >> m >> d)
	{
		t = y*10000+m*100+d;

		if(t < 18680908)
		{
			cout << "pre-meiji" << endl;
		}
		else if(t < 19120730)
		{
			cout << "meiji " << y-1867 << " " << m << " " << d << endl;
		}
		else if(t < 19261225)
		{
			cout << "taisho " << y-1911 << " " << m << " " << d << endl;
		}
		else if(t < 19890108)
		{
			cout << "showa " << y-1925 << " " << m << " " << d << endl;
		}	
		else
		{
			cout << "heisei " << y-1988 << " " << m << " " << d << endl;
		}
	}
}