#include <iostream>

using namespace std;

int main(void){
	int yy,mm,dd;

	while(cin>> yy >> mm >> dd){
		if(yy <= 1867 ||(yy == 1868 && (mm <= 8 || (mm == 9 && dd <= 7)))){
			cout << "pre-meiji" << endl;
		}else if(yy <= 1911 || (yy == 1912 && (mm <= 6 || (mm == 7 && dd <= 29)))){
			cout << "meiji " << yy-1867 << " " << mm << " " << dd << endl;
		}else if(yy <= 1925 || (yy == 1926 && (mm <= 11 || (mm == 12 && dd <= 24)))){
			cout << "taisho " << yy-1911 << " " << mm << " " << dd <<endl;
		}else if(yy <= 1988 || (yy == 1989 && mm == 1 && dd <= 7)){
			cout << "showa " << yy-1925 << " " << mm << " " << dd << endl;
		}else{
			cout << "heisei " << yy-1988 << " " << mm << " " << dd << endl;
 		}
 	}
}