#include <stdio.h>



void Print(int i, int a)
{
	switch (i) {
	case 0:
		printf("pre-meiji\n");
		break;
	case 1:
		printf("meiji %d %d %d\n", a / 10000 - 1867, (a % 10000) / 100, (a % 100));
		break;
	case 2:
		printf("taisho %d %d %d\n", a / 10000 - 1911, (a % 10000) / 100, (a % 100));
		break;
	case 3:
		printf("showa %d %d %d\n", a / 10000 - 1925, (a % 10000) / 100, (a % 100));
		break;
	case 4:
		printf("heisei %d %d %d\n", a / 10000 - 1988, (a % 10000) / 100, (a % 100));
		break;
	}
}


int main(void)
{
	int iy, im, id;
	int kami;

	int meiji = 1868 * 10000 + 9 * 100 + 8;
	int taisho = 1912 * 10000 + 7 * 100 + 30;
	int showa = 1926 * 10000 + 12 * 100 + 25;
	int heisei = 1989 * 10000 + 1 * 100 + 8;

	while (1) {
		if (scanf("%d %d %d", &iy, &im, &id) == EOF) {
			break;
		}

		kami = iy * 10000 + im * 100 + id;

		if (kami<meiji) {
			Print(0, kami);
		} else if (kami >= meiji && kami<taisho) {
			Print(1, kami);
		} else if (kami >= taisho && kami<showa) {
			Print(2, kami);
		} else if (kami >= showa && kami<heisei) {
			Print(3, kami);
		} else {
			Print(4, kami);
		}
	}

	return 0;
}