#include <stdio.h>

int era_transformation(int, int, int);

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

int era_transformation(int y, int m, int d)
{
	if (y > 1989 || 
		(y == 1989 && m > 1) ||
		(y == 1989 && m == 1 && d >= 8)) {
		printf("heisei %d %d %d\n", y - 1989 + 1, m, d);
	} else if (y > 1926 || 
		       (y == 1926 && m == 12 && d >= 25)){
		printf("showa %d %d %d\n", y - 1926 + 1, m, d);
	} else if (y > 1912 ||
		       (y == 1912 && m > 7) ||
		       (y == 1912 && m == 7 && d >= 30)) {
		printf("taisho %d %d %d\n", y - 1912 + 1, m, d);
	} else if (y > 1868 ||
		       (y == 1868 && m > 9) || 
		       (y == 1868 && m == 9 && d >=8)) {
		printf("meiji %d %d %d\n", y - 1868 +1, m, d);
	} else {
		printf("pre-meiji\n");
	}
	return 0;
}