#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

bool ispremeiji(int y,int m,int d){
	if(y<1868)return true;
	else if(y==1868 &&m<9)return true;
	else if(y==1868 &&m==9&&d<8)return true;
	else return false;
}

bool ismeiji(int y,int m,int d){
	if(y<1868||y>1912)return false;
	else{
		if(y==1868 && m<9)return false;
		else{
			if(y==1868&&m==9&&d<8)return false;
			else{
				if(y==1912&&m>8)return false;
				else{
					if(y==1912&&m==7&&d>29)return false;
					else return true;
				}
			}
		}
	}
}

bool istaisho(int y,int m,int d){
	if(y<1912||y>1926)return false;
	else{
		if(y==1912 && m<7)return false;
		else{
			if(y==1912&&m==7&&d<30)return false;
			else{
				if(y==1926&&m>12)return false;
				else{
					if(y==1926&&m==12&&d>24)return false;
					else return true;
				}
			}
		}
	}
}

bool isshowa(int y,int m,int d){
	if(y<1926||y>1989)return false;
	else{
		if(y==1926 && m<12)return false;
		else{
			if(y==1926&&m==12&&d<25)return false;
			else{
				if(y==1989&&m>1)return false;
				else{
					if(y==1989&&m==1&&d>7)return false;
					else return true;
				}
			}
		}
	}
}

int main(){
	int nen,getu,hi;
	while(cin>>nen){
		cin>>getu>>hi;
		if(ispremeiji(nen,getu,hi)){
			cout<<"pre-meiji"<<endl;
		}
		else if(ismeiji(nen,getu,hi)){
			cout<<"meiji "<<nen-1868+1<<" "<<getu<<" "<<hi<<endl;
		}else if(istaisho(nen,getu,hi)){
			cout<<"taisho "<<nen-1912+1<<" "<<getu<<" "<<hi<<endl;
		}else if(isshowa(nen,getu,hi)){
			cout<<"showa "<<nen-1926+1<<" "<<getu<<" "<<hi<<endl;
		}else{
			cout<<"heisei "<<nen-1989+1<<" "<<getu<<" "<<hi<<endl;
		}
	}
	return 0;
}