#include <stdio.h>

void wareki_convert(int year, int month, int day);

int main(void)
{
	int year, month, day;
	while (scanf("%d %d %d", &year, &month, &day) != EOF) {
		wareki_convert(year, month, day);
	}
	return 0;
}

void wareki_convert(int year, int month, int day)
{
	if (year <= 1867 || (year == 1868 && month <=8) || (year == 1868 && month == 9 && day <=7)) {
		printf("pre-meiji\n");
	} else if (year <= 1911 || (year == 1912 && month <=6) || (year == 1912 && month == 7 && day <=29)) {
		int year_wareki =  (year - 1867);
		printf("meiji %d %d %d\n", year_wareki, month, day);
	} else if (year <= 1925 || (year == 1926 && month <=11) || (year == 1926 && month == 12 && day <=24)) {
		int year_wareki =  (year - 1911);
		printf("taisho %d %d %d\n", year_wareki, month, day);
	} else if (year <= 1988 || (year == 1989 && month == 1 && day <=7)) {
		int year_wareki =  (year - 1925);
		printf("showa %d %d %d\n", year_wareki, month, day);
	} else {
		int year_wareki =  (year - 1988);
		printf("heisei %d %d %d\n", year_wareki, month, day);
	}
}