#include <iostream>

int main() {
	int year, month, day;
	int num;
	
	while(std::cin >> year >> month >> day) {
		// YYYYMMDD
		num = 10000 * year + 100 * month + day;
		if(num<18680908) std::cout << "pre-meiji" << std::endl;
		else if(num<19120730) std::cout << "meiji " << (year-1867) << " " << month << " " << day << std::endl;
		else if(num<19261225) std::cout << "taisho " << (year-1911) << " " << month << " " << day << std::endl;
		else if(num<19890108) std::cout << "showa " << (year-1925) << " " << month << " " << day << std::endl;
		else std::cout << "heisei " << (year-1988) << " " << month << " " << day << std::endl;
	}
	
	return 0;
}