#include<iostream>
#include<string>

using namespace std;

#define DATE_MEIJI_S 18680908
#define DATE_MEIJI_F 19190729
#define DATE_TAISHO_S 19190730
#define DATE_TAISHO_F 19261224
#define DATE_SHOWA_S 19261225
#define DATE_SHOWA_F 19890107
#define DATE_HEISEI_S 19890108

class CEra{
public:
	CEra(){}
	void Set(string name, int st, int fin){
		this->name = name;
		this->st = st;
		this->fin = fin;
	}
	void outputString(int y, int m, int d){
		cout << name << ' ' << y - st/10000 + 1 << ' ' << m << ' ' << d << endl; 
	}
	bool dayOf(int date){
		return st <= date && date <= fin;
	}
private:
	string name;
	int st, fin; // yyyymmdd
};

int main(void){
	CEra eras[4];

	eras[0].Set("meiji", DATE_MEIJI_S, DATE_MEIJI_F);
	eras[1].Set("taisho", DATE_TAISHO_S, DATE_TAISHO_F);
	eras[2].Set("showa", DATE_SHOWA_S, DATE_SHOWA_F);
	eras[3].Set("heisei", DATE_HEISEI_S, 100000000);

	while( true ){
		int date = 0;
		int y, m, d;
		bool bElseEra = true;

		cin >> y >> m >> d;
		if( cin.eof() ) break;

		date += y * 10000 + m * 100 + d;

		for(int i = 0; i < sizeof(eras)/sizeof(*eras); i++){
			if( eras[i].dayOf( date ) ){
				eras[i].outputString(y,m,d);
				bElseEra = false;
			}
		}
		if( bElseEra ) cout << "pre-meiji" << endl;
	}
	return 0;
}