#include <iostream>
using namespace std;

int main(){
	int y,m,d;
	while(cin >> y >> m >> d && (y != 0 && m != 0 && d != 0)){
		if(y < 1868) cout << "pre-meiji" << endl;
		else if(y == 1868 && m < 9) cout << "pre-meiji" << endl;
		else if(y == 1868 && m == 9 && d < 8) cout << "pre-meiji" << endl;
		else if(y < 1912) cout << "meiji" << " " << y - 1868 + 1 << " " << m << " " << d << endl;
		else if(y == 1912 && m < 7) cout << "meiji" << " " << y - 1868 + 1 << " " << m << " " << d << endl;
		else if(y == 1912 && m == 7 && d <= 29) cout << "meiji" << " " << y - 1868 + 1 << " " << m << " " << d << endl;
		else if(y < 1926) cout << "taisho" << " " << y - 1912 + 1 << " " << m << " " << d << endl;
		else if(y == 1926 && m < 12) cout << "taisho" <<  " " << y - 1912 + 1 << " " << m << " " << d << endl;
		else if(y == 1926 && m == 12 && d <= 24) cout << "taisho" << " " << y - 1912 + 1 << " " << m << " " << d << endl;
		else if(y < 1989) cout << "showa" << " " << y - 1926 + 1 << " " << m << " " << d << endl;
		else if(y == 1989 && m == 1 && d <= 7) cout << "showa" << " " << y - 1926 + 1 << " " << m << " " << d << endl;
		else cout << "heisei" <<  " " << y - 1989 + 1 << " " << m << " " << d << endl;
	}
	return 0;
}