#include<iostream>
using namespace std;

void slove(int year, int month, int day){
	if(year < 1868 && month <= 9 && day <= 7) cout << "pre-meiji" << endl;
	else if (year == 1868 && month < 9) cout << "pre-meiji" << endl;
	else if (year == 1868 && month == 9 && day < 8) cout << "pre-meiji" << endl;
	else if (year < 1912) cout << "meiji " << year - 1868 + 1 << " " <<  month << " " << day << endl;
	else if (year == 1912 && month < 7) cout << "meiji " << year - 1868 + 1 << " " <<  month << " " << day << endl;
	else if (year == 1912 && month == 7 && day < 30) cout << "meiji " << year - 1868 + 1 << " " <<  month << " " << day << endl;
	else if (year < 1926) cout << "taisho " << year - 1912 + 1 << " " << month << " " << day << endl;
	else if (year == 1926 && month < 12) cout << "taisho " << year - 1912 + 1 << " " << month << " " << day << endl;
	else if (year == 1926 && month == 12 && day < 25) cout << "taisho " << year - 1912 + 1 << " " << month << " " << day << endl;
	else if (year < 1989) cout << "showa " << year - 1926 + 1 << " " << month << " " << day << endl;
	else if (year == 1989 && month < 1) cout << "showa " << year - 1926 + 1 << " " << month << " " << day << endl;
	else if (year == 1989 && month == 1 && day < 8) cout << "showa " << year - 1926 + 1 << " " << month << " " << day << endl;
	else cout << "heisei " << year - 1989 + 1 << " " << month << " " << day << endl;
}

int main(){
	int y,m,d;
	while(cin >> y >> m >> d)
		slove(y,m,d);
	return 0;
}