#include<cstdio>
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;

int main(){
	int y, m, d;
	string gengo[] = {"pre-meiji","meiji","taisho","showa","heisei"};
	string comp[] = {"18680908","19120730","19261225","19890108","99999999"};
	int years[] = {1868,1912,1926,1989};
	while( scanf("%d %d %d",&y,&m,&d) == 3 ){
		char in[10];
		sprintf(in, "%04d%02d%02d",y,m,d);
		int i=0;
		for( ; i<5; i++ ){
			if( atoi(in) < atoi(comp[i].c_str()) ){
				cout << gengo[i];
				break;
			}
		}
		if( i>0 ){
			cout << " " << (y-years[i-1]+1) << " " << m << " " << d;
		}
		cout << endl;
	}
	return 0;
}