#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>

using namespace std;

int y,m,d;
string s="";

string tostr(int t) { 
   ostringstream os; os<<t; 
   return os.str(); 
}

int main(){
	while(cin >> y >> m >> d){
		s = tostr(y);

		if(m/10 == 0){
			s += "/0" + tostr(m);
		}else{
			s += '/' + tostr(m);
		}


		if(d/10 == 0){
			s += "/0" + tostr(d);
		}else{
			s += '/' + tostr(d);
		}

		if(s >= "1989/01/08"){
			printf("heisei %d %d %d\n",y-1989+1,m,d);
		}else if(s >= "1926/12/25"){
			printf("showa %d %d %d\n",y-1926+1,m,d);
		}else if(s >= "1912/07/30"){
			printf("taisho %d %d %d\n",y-1912+1,m,d);
		}else if(s >= "1868/09/08"){
			printf("meiji %d %d %d\n",y-1868+1,m,d);
		}else{
			printf("pre-meiji\n");
		}

	}
}