#include<iostream>
#include<string>
using namespace std;

int main() {
	int year, month, day;
	while(cin>>year>>month>>day){
		if (year < 1868) {//????????\???????????£
			cout << "pre-meiji" << endl;
		}
		else if (year == 1868) {//????????\?????¨???????????´
			if (month = 9) {
				if (day < 8)cout << "pre-meiji" << endl;
				else if (day >= 8)cout << "meiji " << year - 1868 + 1 << ' ' << month << ' ' << day << endl;
			}
			else if (month < 9)cout << "pre-meiji" << endl;
			else if (month > 9)cout << "meiji " << year - 1868 + 1 << ' ' << month << ' ' << day << endl;
		}
		else if (year > 1868 && year < 1912) {//???????????´
			cout << "meiji " << year - 1868 + 1 << ' ' << month << ' ' << day << endl;
		}
		else if (year == 1912) {//????????¨??§??£?????´
			if (month < 7)cout << "meiji " << year - 1868 + 1 << ' ' << month << ' ' << day << endl;
			else if (month > 7)cout << "taisho " << year - 1912 + 1 << ' ' << month << ' ' << day << endl;
			else if (month = 7) {
				if (day <= 24)cout << "meiji " << year - 1868 + 1 << ' ' << month << ' ' << day << endl;
				else if (day > 24)cout << "taisho " << year - 1912 + 1 << ' ' << month << ' ' << day << endl;
			}
		}
		else if (year > 1912 && year < 1926) {//??§??£?????´
			cout << "taisho " << year - 1912 + 1 << ' ' << month << ' ' << day << endl;
		}
		else if (year == 1926) {//??§??£??¨???????????´
			if (month < 12)cout << "taisho " << year - 1912 + 1 << ' ' << month << ' ' << day << endl;
			else if (month = 12) {
				if (day <= 24)cout << "taisho " << year - 1912 + 1 << ' ' << month << ' ' << day << endl;
				else if (day > 24)cout << "showa " << year - 1926 + 1 << ' ' << month << ' ' << day << endl;
			}
		}
		else if (year > 1926 && year < 1989) {//??????????????£
			cout << "showa " << year-1926+1 << ' ' << month << ' ' << day << endl;
		}
		else if (year == 1989) {//????????¨???????????´
			if (month == 1) {
				if (day <= 7)cout << "showa " << year-1926+1 << ' ' << month << ' ' << day << endl;
				else if (day > 7)cout << "heisei " << year - 1989 + 1 << ' ' << month << ' ' << day << endl;
			}
			else if (month > 1)cout << "heisei " << year - 1989 + 1 << ' ' << month << ' ' << day << endl;
		}
		else if (year > 1989) {//??????????????£
			cout << "heisei " << year - 1989 + 1 << ' ' << month << ' ' << day << endl;
		}
	}
}