#include<iostream>
#include<string.h>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

int main()
{
  int year,month,day;

  while(scanf("%d %d %d",&year,&month,&day)!=EOF){

    if(year<1868){
      cout<<"pre-meiji"<<endl;
      continue;
    }
    if(year==1868 && (month<9 || (month==9 && day<8)) ){
      cout<<"pre-meiji"<<endl;
      continue;
    }
    if(year<1912){
      printf("meiji %d %d %d\n",year-1867,month,day);
      continue;
    }
    if(year==1912 && (month<7 || (month==7 && day<30)) ){
	printf("meiji 45 %d %d\n",month,day);
	continue;
    }
    if(year<1926){
      printf("taisho %d %d %d\n",year-1911,month,day);
      continue;
    }
    if(year==1926 &&(month<12 || (month==12 && day<25)) ){
      printf("taisho 15 %d %d\n",month,day);
      continue;
    }
    if(year<1989){
      printf("showa %d %d %d\n",year-1925,month,day);
      continue;
    }
    if(year==1989 && month==1 && day<8 ){
      printf("showa 64 1 %d\n",day);
      continue;
    }
    printf("heisei %d %d %d\n",year-1988,month,day);


  }
}