#include <stdio.h>

int main(void)
{
    while(1) {
	int year, month, day, sum;
	scanf("%d %d %d", &year, &month, &day);
	if (year != EOF) {
	    break;
	}
	sum = 1000 * (year - 1868) + 50 * month + day;
	if (sum < 50 * 9 + 8) {
	    printf("pre-meiji\n");
	} else if (sum < 1000 * (1912 - 1868) + 50 * 7 + 30) {
	    printf("meiji %d %d %d\n", year - 1867, month, day);
	} else if (sum < 1000 * (1926 - 1868) + 50 * 12 + 25) {
	    printf("taisho %d %d %d\n", year - 1911, month, day);
	} else if (sum < 1000 * (1989 - 1868) + 50 * 1 + 8) {
	    printf("showa %d %d %d\n", year - 1925, month, day);
	} else {
	    printf("heisei %d %d %d\n", year - 1988, month, day);
	}
    }
    return 0;
}