#include <iostream>

using namespace std;

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

int main()
{
	solve();
	return(0);
}