#include <cstdio>

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

bool judge_pre_meiji(struct date d);
int era_trans_1(struct date d);
int era_trans_2(int year, int era_n);

int era_l_year[4] = {1868, 1912, 1926, 1989}; //各eraの最初の年
int era_u_year[3] = {1912, 1926, 1989}; //各eraの最後の年
int era_u_month[3] = {7, 12, 1}; //各eraの最後の月
int era_u_day[3] = {29, 24, 7}; //各eraの最後の日
char era_name[4][20] = {"meiji", "taisho", "showa", "heisei"};

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

	while (scanf("%d%d%d", &d.year, &d.month, &d.day) != EOF) {
		if (judge_pre_meiji(d)) {
			printf("pre-meiji\n");
		} else {
			n = era_trans_1(d);
			era_year = d.year - era_l_year[n] + 1;
			printf("%s %d %d %d\n", era_name[n], era_year, d.month, d.day);
		}
	}
}

bool judge_pre_meiji(struct date d)
{//pre-meijiか判定する
	if (d.year < 1868) {
		return true;
	} else if (d.year == 1868 && d.month < 9) {
		return true;
	} else if (d.year == 1868 && d.month == 9 && d.day < 8) {
		return true;
	} else {
		return false;
	}
}
int era_trans_1(struct date d)
{//eraに応じた数字を返す
	int i;
	for (i=0; i<3; i++) {
		if (d.year < era_u_year[i]) {
			break;
		} else if (d.year == era_u_year[i] && d.month < era_u_month[i]){
			break;
		} else if (d.year == era_u_year[i] && d.month == era_u_month[i] && d.day < era_u_day[i]) {
			break;
		}
	}
	//i = 0 :: meiji
	//i = 1 :: taisho
	//i = 2 :: showa
	//i = 3 :: heisei
	return i;
}