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

int main(){

	int y, m, d;
	int v[4][3] = {{1868, 9, 8}, {1912, 7, 30}, {1926, 12, 25}, {1989, 1, 8}};
	string str[5] = {"pre-meiji", "meiji", "taisho", "showa", "heisei"};
	
	while(cin >> y >> m >> d){
		for(int i=0; i<4; i++){
			if(y < v[i][0]){
				if(i != 0) cout << str[i] << " " << y - v[i-1][0] + 1 << " " << m << " " << d << endl;
				else cout << str[0] << endl;
				break;
			}
			else if(y == v[i][0]){
				if(m < v[i][1]){
					if(i != 0) cout << str[i] << " " << y - v[i-1][0] + 1 << " " << m << " " << d << endl;
					else cout << str[0] << endl;
					break;
				}
				else if(m == v[i][1] && d < v[i][2]){
					if(i != 0) cout << str[i] << " " << y - v[i-1][0] + 1 << " " << m << " " << d << endl;
					else cout << str[0] << endl;
					break;
				}
			}
			
			if(i == 3) cout << str[4] << " " << y - v[3][0] + 1 << " " << m << " " << d << endl;
		}
	}

	return 0;

}