#include<iostream>
#include<string>
using namespace std;
int main(){
    int y,m,d,ny;
	string a;
	while(cin>>y>>m>>d){
		a="pre-meiji";
		ny=y+1;
		if(y>1868||y==1868&&m>9||y==1868&&m==9&&d>=8){
			ny-=1868;
			a="meiji ";
		}
		if(y>1912||y==1912&&m>7||y==1912&&m==7&&d>=30){
			ny-=44;
			a="taisho ";
		}
		if(y>1926||y==1926&&m>12||y==1926&&m==12&&d>=25){
			ny-=14;
			a="showa ";
		}
		if(y>1989||y==1989&&m>1||y==1989&&m==1&&d>=8){
			ny-=63;
			a="heisei ";
		}
		cout<<a;
		if(a!="pre-meiji")
		    cout<<ny<<" "<<m<<" "<<d<<endl;
	}
    return 0;
}
 