// 2011/05/25 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int y, m, d;
		cin >> y;
		if(cin.eof())
			break;
		cin >> m >> d;

		int ymd = y*10000+m*100+d;

		if(ymd<18680908)
			cout << "pre-meiji" << endl;
		else if(ymd<19120730)
			cout << "meiji " << y-1867 << " " << m << " " << d << endl;
		else if(ymd<19261225)
			cout << "taisho " << y-1911 << " " << m << " " << d << endl;
		else if(ymd<19890108)
			cout << "showa " << y-1925 << " " << m << " " << d << endl;
		else
			cout << "heisei " << y-1988 << " " << m << " " << d << endl;
	}

	return 0;
}