#include <cstdio>
using namespace std;

int main(void){
  int y,m,d;
  int data;
  while(~scanf("%d %d %d",&y,&m,&d)){
    data=y*10000+m*100+d;
    if(data<=18680907){
      printf("pre-meiji\n");
    }
    else if(18680908<=data&&data<=19120729){
      printf("meiji %d %d %d\n",y-1867,m,d);
    }
    else if(19120730<=data&&data<=19261224){
      printf("taisho %d %d %d\n",y-1911,m,d);
    }
    else if(19261225<=data&&data<=19890107){
      printf("showa %d %d %d\n",y-1925,m,d);
    }
    else if(19890108<=data){
      printf("heisei %d %d %d\n",y-1988,m,d);
    }
  }
  return 0;
}