#include <iostream>
using namespace std;
int era(int x,int y,int m,int d){
	switch(x){
	case 1:
		cout<<"pre-meiji"<<endl;
		break;
	case 2:
		cout<<"meiji "<<y-1867<<" "<<m<<" "<<d<<endl;
		break;
	case 3:
		cout<<"taisho "<<y-1911<<" "<<m<<" "<<d<<endl;
		break;
	case 4:
		cout<<"showa "<<y-1925<<" "<<m<<" "<<d<<endl;
		break;
	case 5:
		cout<<"heisei "<<y-1988<<" "<<m<<" "<<d<<endl;
		break;
	}
	return 0;
}

int main(){
	int y,m,d,x;
	while(cin>>y>>m>>d){
		if(y<1868) x=1;
		else if(y==1868){
			if(m<9) x=1;
			else if(m==9){
				if(d<8) x=1;
				else x=2;
			}
			else x=2;
		}
		else if(y>1868 && y<1912) x=2;
		else if(y==1912){
			if(m<7) x=2;
			else if(m==7){
				if(d<30) x=2;
				else x=3;
			}
			else x=3;
		}
		else if(y>1912 && y<1926) x=3;
		else if(y==1926){
			if(m<12) x=3;
			else if(m==12){
				if(d<25) x=3;
				else x=4;
			}
		}
		else if(y>1926 && y<1989) x=4;
		else if(y==1989){
			if(m==1){
				if(d<8) x=4;
				else x=5;
			}
			else x=5;
		}
		else x=5;

		era(x,y,m,d);
	}
	return 0;
}