#include <stdio.h>

char judge(int year, int month, int day);


int main (void)
{
	int year,month,day;
	char era;
	while (scanf("%d %d %d", &year, &month, &day) != EOF) {
		era = judge(year, month, day);
		if (era == 'p') {
			printf("pre-meiji\n");
		}else if (era == 'm') {
			printf("meiji %d %d %d\n", year - 1867, month, day);
		}else if (era == 't') {
			printf("taisho %d %d %d\n", year - 1911, month, day);
		}else if (era == 's') {
			printf("showa %d %d %d\n", year - 1925, month, day);
		}else if (era == 'h') {
			printf("heisei %d %d %d\n", year - 1988, month, day);
		}
	}
	return 0;
}

char judge(int year, int month, int day)
{
	//pre-meiji or meiji
	if (year < 1868) {
		return 'p';
	}else if (year == 1868) {
		if (month < 9) {
			return 'p';
		}else if (month == 9) {
			if (day < 8) {
				return 'p';
			}else{
				return 'm';
			}
		}else{
			return 'm';
		}
	}else if (year < 1912) {
	//meiji or taisho
		return 'm';
	}else if (year == 1912) {
		if (month < 7) {
			return 'm';
		}else if (month == 7) {
			if (day < 30) {
				return 'm';
			}else{
				return 't';
			}
		}else{
			return 't';
		}
	}else if (year < 1926) {
	//taisho or showa
		return 't';
	}else if (year == 1926) {
		if (month < 12) {
			return 't';
		}else if (month == 12) {
			if (day < 25) {
				return 't';
			}else{
				return 's';
			}
		}else{
			return 's';
		}
	}else if (year < 1989) {
		return 's';
	}else if (year == 1989) {
		if (month == 1) {
			if (day < 8) {
				return 's';
			}else{
				return 'h';
			}
		}
		return 'h';
	}else{
		return 'h';
	}
}