#include <stdio.h>

main(){
  int y, m, d, data;

  while(1){
    if(scanf("%d %d %d", &y, &m, &d)==EOF) break;

    data=y*10000+m*100+d;

    if(data<18680908){
      printf("pre-meiji\n");
    }
    else if(data<19120730){
      printf("meiji %d %d %d\n", y-1867, m, d);
    }
    else if(data<19261225){
      printf("taisho %d %d %d\n", y-1911, m, d);
    }
    else if(data<19890108){
      printf("showa %d %d %d\n", y-1925, m, d);
    }
    else{
      printf("heisei %d %d %d\n", y-1988, m, d);
    }
  }
  return 0;
}