#include <iostream>
#include <cstdio>

using namespace std;

int main(){
	
	int yy, mm, dd;
	
	string str;
	
	while(true){
		cin >> yy;
		
		if(cin.eof()){
			break;
		}
		
		cin >> mm >> dd;
		
		if(yy < 1868){
			printf("pre-meiji\n");
		}else if(yy > 1989){
			printf("heisei %d %d %d\n", yy - 1988, mm, dd);
		}else{
			str = "pre-meiji";
			for(int y = 1868; y < 1990; y++){
				for(int m = 1; m <= 12; m++){
					for(int d = 1; d <= 31; d++){
						if(y == 1868 && m == 9 && d == 8){
							str = "meiji";
						}else if(y == 1912 && m == 7 && d == 30){
							str = "taisho";
						}else if(y == 1926 && m == 12 && d == 25){
							str = "showa";
						}else if(y == 1989 && m == 1 && d == 8){
							str = "heisei";
						}
						if(y == yy && m == mm && d == dd){
							if(str == "pre-meiji"){
								printf("pre-meiji\n");
							}else if(str == "meiji"){
								printf("meiji %d %d %d\n", yy - 1867, mm, dd);
							}else if(str == "taisho"){
								printf("taisho %d %d %d\n", yy - 1911, mm, dd);
							}else if(str == "showa"){
								printf("showa %d %d %d\n", yy - 1925, mm, dd);
							}else if(str == "heisei"){
								printf("heisei %d %d %d\n", yy - 1988, mm, dd);
							}
						}
					}
				}
			}
		}
	}
	
	return 0;
}