#include<stdio.h>
 
int main(){
	int y, m, d;
	while(scanf("%d %d %d", &y, &m, &d) != EOF){
		if(y < 1868) printf("pre-meiji\n");
		else if(y == 1868){
			if(m < 9) printf("pre-meiji\n");
			else if(m == 9){
				if(d < 8) printf("pre-meiji\n");
				else printf("meiji %d %d %d\n", y - 1867, m, d);
			}
			else printf("meiji %d %d %d\n", y - 1867, m, d);
		}
		else if(y < 1912) printf("meiji %d %d %d\n", y - 1867, m, d);
		else if(y == 1912){
			if(m < 7) printf("meiji %d %d %d\n", y - 1867, m, d);
			else if(m == 7){
				if(d <= 29) printf("meiji %d %d %d\n", y - 1867, m, d);
				else printf("taisho %d %d %d\n", y - 1911, m, d);
			}
			else printf("taisho %d %d %d\n", y - 1911, m, d);
		}
		else if(y < 1926) printf("taisho %d %d %d\n", y - 1911, m, d);
		else if(y == 1926){
			if(m < 12) printf("taisho %d %d %d\n", y - 1911, m, d);
			else if(m == 12){
				if(d <= 24) printf("taisho %d %d %d\n", y - 1911, m, d);
				else printf("showa %d %d %d\n", y - 1925, m, d);
			}
		}
		else if(y < 1989) printf("showa %d %d %d\n", y - 1925, m, d);
		else if(y == 1989){
			if(m == 1){
				if(d <= 7) printf("showa %d %d %d\n", y - 1925, m, d);
				else printf("heisei %d %d %d\n", y - 1988, m, d);
			}
			else printf("heisei %d %d %d\n", y - 1988, m, d);
		}
		else printf("heisei %d %d %d\n", y - 1988, m, d);
	}
	return 0;
}