#include <iostream>

using namespace std;

void solve()
{
	int y, m, d;
	while(cin >> y >> m >> d)
	{
		int date = d + 100 * m + 10000 * y;
		if(date < 18680908)
		{
			cout << "pre-meiji" << endl;
		}
		else if(18680908 <= date && date <= 19120729)
		{
			cout << "meiji ";
			cout << y - 1868 + 1 << " " << m << " " << d << endl;
		}
		else if(19120730 <= date && date <= 19261224)
		{
			cout << "taisho ";
			cout << y - 1912 + 1 << " " << m << " " << d << endl;
		}
		else if(19261225 <= date && date <= 19890107)
		{
			cout << "showa ";
			cout << y - 1926 + 1 << " " << m << " " << d << endl;
		}
		else if(19890108 <= date)
		{
			cout << "heisei ";
			cout << y - 1989 + 1 << " " << m << " " << d << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}