#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <bitset>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif



int main(int argc, char **argv){
	int year, month, date;
	int imeiji_s = 1868;
	int itaish_s = 1912;
	int ishowa_s = 1926;
	int iheise_s = 1989;
	std::string meiji_s = "18680908";
	std::string meiji_e = "19120729";
	std::string taish_e = "19261224";
	std::string showa_e = "19890107";

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif

#if INPUT_FROM_FILE
	while(ifs >> year >> month >> date){
#else
	while(std::cin >> year >> month >> date){
#endif
		char buf[10];
		std::string now;

		sprintf(buf, "%d%02d%02d", year, month, date);
		now = buf;

		if(now < meiji_s){
			std::cout << "pre-meiji" << std::endl;
		}
		else if(now <= meiji_e){
			std::cout << "meiji " << year - imeiji_s + 1 << " " << month << " " << date << std::endl;
		}
		else if(now <= taish_e){
			std::cout << "taisho " << year - itaish_s + 1 << " " << month << " " << date << std::endl;
		}
		else if(now <= showa_e){
			std::cout << "showa " << year - ishowa_s + 1 << " " << month << " " << date << std::endl;
		}
		else{
			std::cout << "heisei " << year - iheise_s + 1 << " " << month << " " << date << std::endl;
		}
		
	}


 
#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}
