#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>
#include <cmath>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

int yy,mm,dd;
int geg[][3] ={{-9999,1,1},{1868,9,8},{1912,7,30},{1926,12,25},{1989,1,8},{9999,12,31}};
	string gen[] ={"pre-meiji","meiji","taisho","showa","heisei"};
	while(cin >>yy >>mm >>dd){
		if( cin.eof()) break;
		string disgen = ""; int disnen;
		rep2(i,1,6){
			int yymm =  geg[i][0] * 12 + geg[i][1];
			if(yy * 12 + mm < yymm ||
			yy * 12 + mm == yymm && dd < geg[i][2] ){
				disgen =  gen[i-1];
				disnen = yy - geg[i-1][0] + 1;
				break;
			}
		}
		if(disgen == "pre-meiji") cout << disgen << endl;
		else cout << disgen << " "<< disnen << " " << mm << " " << dd << endl;
	}
	return 0;
	
}