#include<iostream>

int border[4] = { 18680908, 19120730, 19261225, 19890108 };
char* gengo[4] = { "meiji", "taisho", "showa", "heisei" };

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

		if( n < border[0] )
			std::cout << "pre-meiji" << std::endl;
		else if( n >= border[3] )
			std::cout << "heisei " << y - 1989 + 1 << " " << m << " " << d << std::endl;

		for( int i = 0; i != 3; ++i )
			if( border[i] <= n && n < border[i+1] )
				std::cout << gengo[i] << " " << y - border[i] / 10000 + 1 << " " << m << " " << d << std::endl;
	}

	return 0;
}