#include <iostream>
#include <string>

using namespace std;

int main(int argc, char **argv)
{
	int y, m, d, tmp;
	string str;
	
	while(cin >> y >> m >> d){
		if(y < 1868){
			cout << "pre-meiji" << endl;
			continue;
		} else if(y < 1912){
			if(y == 1868){
				if((m < 9) || (m == 9 && d < 8)){
					cout << "pre-meiji" << endl;
					continue;
				}
			}
			tmp = 1867;
			str = "meiji ";
		} else if(y < 1926){
			if(y == 1912 && (m < 7 || (m == 7 && d < 30))){
				str = "meiji ";
				tmp = 1867;
			} else {
				str = "taisho ";
				tmp = 1911;
			}
		} else if(y < 1989){
			if(y == 1926 && (m < 12 || (m == 12 && d < 25))){
				str = "taisho ";
				tmp = 1911;
			} else {
				str = "showa ";
				tmp = 1925;
			}
		} else {
			if(y == 1989 && (m == 1 && d < 8)){
				str = "showa ";
				tmp = 1925;
			} else {
				str = "heisei ";
				tmp = 1988;
			}
		}
		
		cout << str << (y-tmp) << " " << m << " " << d << endl;
	}
	
	return 0;
}