#include <cstdio>

struct date{
	int year, month, day;
};

int era_trans(struct date d);

int era_year[4] = {1868, 1912, 1926, 1989}; //各eraの最初の年
int era_month[4] = {9, 7, 12, 1}; //各eraの最初の月
int era_day[4] = {8, 30, 25, 8}; //各eraの最初の日
char era_name[4][20] = {"meiji", "taisho", "showa", "heisei"};

int main(void)
{
	struct date d;
	int n, ans_year;

	while (scanf("%d%d%d", &d.year, &d.month, &d.day) != EOF) {
		n = era_trans(d);
		if (n == 0) {//n == 0 <-> pre-meijiだったら
			printf("pre-meiji\n");
		} else {
			ans_year = d.year - era_year[n-1] +1;
			printf("%s %d %d %d\n", era_name[n-1], ans_year, d.month, d.day);
		}
	}
}
int era_trans(struct date d)
{//eraに応じた数字を返す
	int i;
	for (i=0; i<4; i++) {
		if (d.year < era_year[i]) {
			break;
		} else if (d.year == era_year[i] && d.month < era_month[i]){
			break;
		} else if (d.year == era_year[i] && d.month == era_month[i] && d.day < era_day[i]) {
			break;
		}
	}
	//i = 0 :: pre-meiji
	//i = 1 :: meiji
	//i = 2 :: taisho
	//i = 3 :: showa
	//i = 4 :: heisei
	return i;
}