#include <iostream>

using namespace std;

long long int func(int year,int month,int day){
	return (year*10000+month*100+day);
}

int main(){
	long long int data[4];
	data[0] = 1868*10000+9*100+8;
	data[1] = 1912*10000+7*100+29;
	data[2] = 1926*10000+12*100+24;
	data[3] = 1989*10000+1*100+7;

	long long int num;
	int year,month,day;
	while(cin>>year){
		cin>>month;
		cin>>day;
		num = func(year,month,day);
		if(num<data[0]){
			cout<<"pre-meiji"<<endl;
		}
		else if(data[0]<=num&&num<=data[1]){
			cout<<"meiji"<<year - 1868 + 1<<" "<<month<<" "<<day<<endl;
		}
		else if(data[1]<=num&&num<=data[2]){
			cout<<"taisho"<<year - 1912 + 1<<" "<<month<<" "<<day<<endl;
		}
		else if(data[2]<=num&&num<=data[3]){
			cout<<"showa"<<year - 1926 + 1<<" "<<month<<" "<<day<<endl;
		}
		else{
			cout<<"heisei"<<year - 1989 + 1<<" "<<month<<" "<<day<<endl;
		}
	}

	return 0;
}

/*
Sample Input
2005 9 3
1868 12 2
1868 9 7
Output for the Sample Input
heisei 17 9 3
meiji 1 12 2
pre-meiji
*/