#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
using namespace std;

const int dat[5]={19890108,19261225,19120730,18680908,0};
const char *nengo[5]={"heisei","showa","taisho","meiji","pre-meiji"};

int main(){
	int Y,M,D;
	while(cin>>Y>>M>>D){
		int indat = Y*10000+M*100+D;
		for(int i=0;i<5;i++){
			if(indat>=dat[i]){
				printf("%s",nengo[i]);
				if(i<4){
					printf(" %d %d %d",Y-dat[i]/10000+1,M,D);
				}puts("");
				break;
			}
		}
	}
	return 0;
}