#include<cstdio>
#include<iostream>

#define CHA (y-1)*365+(m-1)*30+(d-1)*1
using namespace std;

int main(void){

	int y,m,d;
	int iy,im,id;
	int ay,sum;

	while(cin>>iy>>im>>id){
		y=iy,m=im,d=id,sum=CHA;
			 if(y=1989,m=1,d=8,CHA<=sum) cout<<"heisei ";
		else if(y=1926,m=12,d=25,CHA<=sum) cout<<"showa ";
		else if(y=1912,m=7,d=30,CHA<=sum) cout<<"taisho ";
		else if(y=1868,m=9,d=8,CHA<=sum) cout<<"meiji ";
		else{
				cout<<"pre-meiji"<<endl;
				continue;
			}
			ay=iy-y+1;
			if(im-m<=0&&id-d<0) ay--;
			cout<<ay<<" "<<im<<" "<<id<<endl;
	}
	
	return 0;
}