#include <stdio.h>
int Y, M, D;
bool is_leap(int y) {
	return y % 400 == 0 || (y % 4 == 0 && y % 100 != 0);
}
int count(int y, int m, int d) {
	int ret = 0;
	for(int i = 1; i < y; i++) {
		if(is_leap(i)) ret += 366;
		else ret += 365;
	}
	for(int i = 1; i < m; i++) {
		if(i == 2) ret += (is_leap(y) ? 29 : 28);
		else if(i == 4 || i == 6 || i == 9 || i == 11) ret += 30;
		else ret += 31;
	}
	return ret + d;
}
int main() {
	while(~scanf("%d%d%d", &Y, &M, &D)) {
		if(count(Y, M, D) >= count(1989,  1,  8)) printf("heisei %d %d %d\n", Y - 1988, M, D);
		else if(count(Y, M, D) >= count(1926, 12, 25)) printf("showa %d %d %d\n", Y - 1925, M, D);
		else if(count(Y, M, D) >= count(1912,  7, 30)) printf("taisho %d %d %d\n", Y - 1911, M, D);
		else if(count(Y, M, D) >= count(1868,  9,  8)) printf("meiji %d %d %d\n", Y - 1867, M, D);
		else printf("pre-meiji\n");
	}
}