#include <iostream>
using namespace std;
int main()
{
	int y, m, d, x;
	while (cin >> y >> m >> d)
	{
		x = y*366*12 + m*12 + d;
		if (1868*12*366 + 9*12 + 8 <= x && x <= 1912*12*366 + 7*12 + 29)
			cout << "meiji " << y-1867;
		else if (1912*12*366 + 7*12 + 30 <= x && x <= 1926*12*366 + 12*12 + 24)
			cout << "taisho " << y-1911;
		else if (1926*12*366 + 12*12 + 25 <= x && x <= 1989*12*366 + 1*12 + 7)
			cout << "showa " << y-1925;
		else if (1989*12*366 + 1*12 + 8 <= x)
			cout << "heisei " << y-1988;
		if (x <= 1868*12*366 + 9*12 + 7)
			cout << "pre-meiji" << endl;
		else
			cout << " " << m << " " << d << endl;
	}
}