#include <iostream>
#include <stdio.h>
using namespace std;

struct nen {
	char c[7];
	int y,m,d;
};

int main() {
	nen n[4]={{"heisei",1989,1,8},{"showa",1926,12,25},{"taisho",1912,7,30},{"meiji",1868,9,8}};
    int y,m,d,i;
	while(cin >> y >> m >> d) {
		for (i=0;i<4;i++) if (n[i].y*100+n[i].m*10+n[i].d<=y*100+m*10+d) break;
		if (i<4) cout << n[i].c << ' ' << y-n[i].y+1 << ' ' << m << ' ' << d << endl; else cout << "pre-meiji" << endl;
	}
return 0;
}