#include <iostream>
using namespace std;
int main(){
	int y,m,d;
	while(cin >> y >> m >> d){
		int w = y*10000 + m*100 + d;
		if(w<18680908) cout << "pre-meiji" << endl;
		else if(w<19120730) cout << "meiji " << y-1867 << " " << m << " " << d << endl;
		else if(w<19261225) cout << "taisho " << y-1911 << " " << m << " " << d << endl;
		else if(w<19890108) cout << "showa " << y-1925 << " " << m << " " << d << endl;
		else cout << "heisei " << y-1988 << " " << m << " " << d << endl;
	}
}