#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){

	int y,m,d;
	while(cin>>y>>m>>d){
		if(y<=1867){
			cout<<"pre-meiji"<<endl;
		}
		else if(y>=1869&&y<=1911){
			cout<<"meiji ";
			cout<<y-1867<<" "<<m<<" "<<d<<endl;
		}
		else if(y>=1913&&y<=1925){
			cout<<"taisho ";
			cout<<y-1911<<" "<<m<<" "<<d<<endl;
		}
		else if(y>=1927&&y<=1988){
			cout<<"showa ";
			cout<<y-1925<<" "<<m<<" "<<d<<endl;
		}
		else if(y>=1990){
			cout<<"heisei ";
			cout<<y-1988<<" "<<m<<" "<<d<<endl;
		}
		else{
			if(y==1868){
				if((m<=8)||(m==9&&d<=7)){
					cout<<"pre-meiji"<<endl;
				}
				else{
					cout<<"meiji ";
					cout<<y-1867<<" "<<m<<" "<<d<<endl;
				}
			}
			else if(y==1912){
				if((m<=6)||(m==7&&d<=29)){
					cout<<"meiji ";
					cout<<y-1867<<" "<<m<<" "<<d<<endl;
				}
				else{
					cout<<"taisho ";
					cout<<y-1911<<" "<<m<<" "<<d<<endl;
				}
			}
			else if(y==1926){
				if((m<=11)||(m==12&&d<=24)){
					cout<<"taisho ";
					cout<<y-1911<<" "<<m<<" "<<d<<endl;
				}
				else{
					cout<<"showa ";
					cout<<y-1925<<" "<<m<<" "<<d<<endl;
				}
			}
			else if(y==1989){
				if(m==1&&d<=7){
					cout<<"showa";
					cout<<y-1925<<" "<<m<<" "<<d<<endl;
				}
				else{
					cout<<"heisei";
					cout<<y-1988<<" "<<m<<" "<<d<<endl;
				}
			}
		}
	}

	return 0;
}