#include <stdio.h>

int main(void)
{
    int year, month, day, sum;
    while(scanf("%d %d %d", &year, &month, &day) != EOF) {
	sum = 10000 * year+ 100 * month + day;
	if (sum < 18680907) {
	    printf("pre-meiji\n");
	} else if (sum < 19120730) {
	    printf("meiji %d %d %d\n", year - 1867, month, day);
	} else if (sum < 19261225) {
	    printf("taisho %d %d %d\n", year - 1911, month, day);
	} else if (sum < 19890108) {
	    printf("showa %d %d %d\n", year - 1925, month, day);
	} else {
	    printf("heisei %d %d %d\n", year - 1988, month, day);
	}
    }
    return 0;
}