#include <iostream>

using namespace std;
/** Problem0083 : Era Name Transformation **/
int main()
{
	int y, m, d, dd;
	
	while (cin >> y >> m >> d) {
		dd = y*10000 + m*100 + d;
		if (dd < 18680908)
			cout << "pre-meiji" << endl;
		else if (dd < 19120730)
			cout << "meiji " << y-1867 << " " << m << " " << d << endl;
		else if (dd < 19261225)
			cout << "taisho " << y-1911 << " " << m << " " << d << endl;
		else if (dd < 19890108)
			cout << "showa " << y-1925 << " " << m << " " << d << endl;
		else
			cout << "heisei " << y-1988 << " " << m << " " << d << endl;
	}
	return 0;
}