#include <cstdio>
using namespace std;

int toint(int y, int m, int d){
	return y * 400 + m * 32 + d;
}

int main(){
	int y, m, d;
	int mj = toint(1868, 9, 8);
	int ts = toint(1912, 7, 30);
	int sw = toint(1926, 12, 25);
	int hs = toint(1989, 1, 8);

	while(scanf("%d%d%d", &y, &m, &d) == 3){
		const char *fmt = "pre-meiji\n";
		int u = toint(y, m, d);

		if(u >= hs){
			fmt = "heisei %d %d %d\n";
			y -= 1988;
		}
		else if(u >= sw){
			fmt = "showa %d %d %d\n";
			y -= 1925;
		}
		else if(u >= ts){
			fmt = "taisho %d %d %d\n";
			y -= 1911;
		}
		else if(u >= mj){
			fmt = "meiji %d %d %d\n";
			y -= 1867;
		}
		printf(fmt, y, m, d);
	}
}