#include <cstdio>
#include <iostream>
using namespace std;
int main(){
	int y,m,d,x;
	while (cin >> y >> m >> d){
		x = y * 10000 + m * 100 + d;
		if (x < 18680908) cout << "pre-meiji\n";
		else if (x < 19120730) printf("meiji %d %d %d\n", y - 1867, m,d);
		else if (x < 19261225) printf("taisho %d %d %d\n", y - 1911, m, d);
		else if (x < 19890108) printf("showa %d %d %d\n", y - 1925, m, d);
		else printf("heisei %d %d %d\n", y - 1988, m, d);
	}
}