#include <iostream>
using namespace std;

int main(){
	int y,m,d,p;
	while(cin >> y >> m >> d){
		p = y*10000 +100*m + d;
		if(p >= 1989*10000 + 100 + 8){
			cout << "heisei" << " " << y-1989+1 << " " << m << " " << d;
		}else if(p >= 1926*10000 + 1200 + 25){
			cout << "showa" << " " << y-1926+1 << " " << m << " " << d;
		}else if(p >= 1912*10000 + 700 + 30){
			cout << "taisho" << " " << y-1912+1 << " " << m << " " << d;
		}else if(p >= 1868*10000 + 900 + 8){
			cout << "meiji" << " " << y-1868+1 << " " << m << " " << d;
		}else{
			cout << "pre-meiji";
		}
		cout << endl;
	}
}