#include <iostream>
using namespace std;

int main()
{
	int a,b,c;
	while(cin >> a >> b >> c)
	{
		if(a <= 1868 && b <= 9 && c <= 7)
		{
			cout << "pre-meiji" << endl;
		}
		else if(a >= 1868 && b >= 9 && c > 7 && a <= 1912 && b <= 7 && c <= 29)
		{
			cout << "meiji "  << a - 1867 << " " << b << " " << c << endl;
		}
		else if(a >= 1912 && b >= 7 && c > 29 && a <= 1926 && b <= 12 && c <= 24)
		{
			cout << "taisyo " << a - 1911 << " " << b << " " << c << endl;
		}
		else if(a >= 1926 && b >= 12 && c > 24 && a <= 1989 && b <= 1 && c <= 7)
		{
			cout << "syouwa " << a - 1925 << " " << b << " " << c << endl;
		}
		else
		{
			cout << "heisei " << a - 1988 << " " << b << " " << c << endl;
		}
	}
	return 0;
}