#include <stdio.h>
void date_diff(int *a, int x) {*a=*a-x+1;}
bool cmp(int a, int b, int c, int x, int y, int z) {if (a!=x) return a>x;if (b!=y) return b>y;return c>=z;}
int main() {int y,m,d;while (scanf("%d %d %d",&y,&m,&d)!=EOF) {if (cmp(y,m,d,1989,1,8)) {printf("heisei");date_diff(&y,1989);} else if (cmp(y,m,d,1926,12,25) && !cmp(y,m,d,1989,1,8)) {printf("showa");date_diff(&y,1926);} else if (cmp(y,m,d,1912,7,30) && !cmp(y,m,d,1926,12,25)) {printf("taisho");date_diff(&y,1912);} else if (!cmp(y,m,d,1868,9,8)) {puts("pre-meiji");continue;} else {printf("meiji");date_diff(&y,1868);} printf(" %d %d %d\n",y,m,d);} return 0;}