#include <bits/stdc++.h>
#define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) range(i,0,n)
using namespace std;

#define cmp(a1,b1,c1,a2,b2,c2) (a1<a2||(a1==a2&&b1<b2)||(a1==a2&&b1==b2&&c1<=c2))

inline void output(int y,int m,int d){
	if(cmp(1989,1,8,y,m,d)){
		cout << "heisei ";
		cout << y-1989+1 << " " << m << " " << d << endl;
	}else if(cmp(1926,12,25,y,m,d)){
		cout << "showa ";
		cout << y-1926+1 << " " << m << " " << d << endl;
	}else if(cmp(1912,7,30,y,m,d)){
		cout << "taisho ";
		cout << y-1912+1 << " " << m << " " << d << endl;
	}else if(cmp(1868,9,8,y,m,d)){
		cout << "meiji ";
		cout << y-1868+1 << " " << m << " " << d << endl;
	}else{
		cout << "pre-meiji" << endl;
	}
	return ;
}

int main(void){
	int y,m,d;
	while(cin >> y >> m >> d){
		if(cin.eof()) break;
		output(y,m,d);
	}
	return 0;
}