#include <cstdio>

using namespace std;

int main()
{
	int year, month, day;
	bool flag;
	
	while (scanf("%d %d %d", &year, &month, &day) != EOF){
		flag = true;
		if (year >= 1989){
			if (year == 1989 && month == 1 && day < 8){
			}
			else {
				year -= 1989 - 1;
				printf("heisei %d %d %d\n", year, month, day);
				flag = false;
			}
		}
		if (year >= 1926){
			if (year == 1926 && month <= 12 && day < 25){
			}
			else {
				year -= 1926 - 1;
				printf("showa %d %d %d\n", year, month, day);
				flag = false;
			}
		}
		if (year >= 1912){
			
			if (year == 1912 && month <= 7 && day < 30){
			}
			else {
				year -= 1912 - 1;
				printf("taisho %d %d %d\n", year, month, day);
				flag = false;
			}
		}
		if (year >= 1868){
			if (year == 1868 && month <= 9 && day < 8){
			}
			else {
				year -= 1868 - 1;
				printf("meiji %d %d %d\n", year, month, day);
				flag = false;
			}
		}
		if (year <= 1868 && flag){
			printf("pre-meiji\n");
		}
	}
}