#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>
  
using namespace std;
  
#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


int getday(int y,int m,int d){
	return y*366 + (m-1)*32 + d;
}


int main(){
	
	string hoge[5]={"pre-meiji","meiji","taisho","showa","heisei"};
	
	int sp[5];
	sp[0] = getday(1868,9,8);
	sp[1] = getday(1912,7,30);
	sp[2] = getday(1926,12,25);
	sp[3] = getday(1989,1,8);
	sp[4] = getday(10000,1,8);
	
	int mn[5]={0,1868,1912,1926,1989};
	
	int a,b,c;
	while(cin>>a>>b>>c){
		rep(i,5){
			if(getday(a,b,c)<sp[i]){
				cout<<hoge[i];
				if(i!=0){
					cout<<" "<<a-mn[i]+1<<" "<<b<<" "<<c;
				}
				cout<<endl;
				break;
			}
		}
	}
}