#include <stdio.h>

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

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