#include <iostream>

using namespace std;

int main(){
	char c[20];
	while(cin.getline(c,16)){
		int y,m,d;
		y = c[0]*1000+c[1]*100+c[2]*10+c[3];
		y -= '0'*1111;
		m = d = 0;
		int i = 5;
		while(c[i] != ' '){
			m *= 10;
			m += c[i]-'0';
			++i;
		}
		++i;
		while(c[i]){
			d *= 10;
			d += c[i]-'0';
			++i;
		}
		if(y > 1989 || (y == 1989 && (m > 1 || d >= 8))) cout << "heisei " << y-1988 << " " << m << " " << d << endl;
		else if(y-1926 > 0 || (y == 1926 && m == 12 && d >= 25)) cout << "showa " << y-1925 << " " << m << " " << d << endl;
		else if(y > 1912 || (y == 1912 && (m > 7 || (m == 7 && d >= 30)))) cout << "taisho " << y-1911 << " " << m << " " << d << endl;
		else if(y > 1868 || (y == 1868 && (m > 9 || ( m == 9 && d >= 8)))) cout << "meiji " << y-1867 << " " << m << " " << d << endl;
		else cout << "pre-meiji" << endl;
	}
}