#include <stdio.h>

class Date{
public:
	int y;
	int m;
	int d;
	
	Date(int y, int m, int d){
		this->y =y; this->m = m; this->d = d;
	}
	int cmp(Date d2){
		if (this->y < d2.y) return -1;
		if (this->y > d2.y) return 1;
		if (this->m < d2.m) return -1;
		if (this->m > d2.m) return 1;
		if (this->d < d2.d) return -1;
		if (this->d > d2.d) return 1;
		return 0;
	}
	int cmp(int y, int m, int d){
		Date *tmp = new Date(y,m,d);
		return cmp(*tmp);
	}
};



int main(void){
	int y,m,d;
	
	while (scanf("%d%d%d",&y,&m,&d)!=EOF){
		Date *date = new Date(y,m,d);
		if (date->cmp(1868,9,8) == -1){
			puts("pre-meiji");
		} else if (date->cmp(1912,7,30) == -1){
			printf("meiji %d %d %d\n", y-1868+1, m, d);
		} else if (date->cmp(1926,12,25) == -1){
			printf("taisho %d %d %d\n", y-1912+1,m,d);
		} else if (date->cmp(1989,1,8) == -1){
			printf("showa %d %d %d\n", y-1926+1,m,d);
		} else {
			printf("heisei %d %d %d\n", y-1989+1,m,d);
		}
		delete date;
	}
	
	return 0;
}