#include <iostream>
#include <string>
using namespace std;

int main()
{
	int a,b,c;
	while(cin >> a >> b >> c)
	{
		int n = a * 10000 + b * 100 + c;
		if(n < 18680908)
		{
			cout << "pre-meiji" << endl;
		}
		else if(18680908 <= n && n < 19120730)
		{
			cout << "meiji " << a - 1867 << " " << b << " " << c << endl;
		}
		else if(19120730 <= n && n < 19261225)
		{
			cout << "taisho " << a - 1911 << " " << b << " " << c << endl;
		}
		else if(19261225 <= n && n < 19890108)
		{
			cout << "showa " << a - 1925 << " " << b << " " << c << endl;
		}
		else if(19890108 <= n)
		{
			cout << "heisei " << a - 1988 << " " << b << " " << c << endl;
		}
	}
	return 0;
}