#include<iostream>
#include<map>
#define Iter(c) __typeof__((c).begin())
#define foreach(i,c) for(Iter(c) i=(c).begin();i!= (c).end();++i)
#define S second
#define F first
#define rep(i,s) for(int i=0;i<s;i++)
using namespace std;
typedef pair<int,int> P;
int days[2][13] = {
  {31,29,31,30,31,30,31,31,30,31,30,31},//leap
  {31,28,31,30,31,30,31,31,30,31,30,31}// no
};



int YMOtoInt(int Y,int M,int O){
  int x,leap;
  if(Y%4 == 0 && Y%100 != 0 || Y%400 == 0)leap = 0;
  else leap = 1;
  x = Y*10000;
  rep(i,M-1)x += days[leap][i]*100;
  x += O;
  return x;
}


int main(){
  int Y,M,O;
  map<string,P> era; 
  era["meiji"] = P(YMOtoInt(1868,9,8),YMOtoInt(1912,7,29));
  era["taisho"] = P(YMOtoInt(1912,7,30),YMOtoInt(1926,12,24));
  era["showa"] = P(YMOtoInt(1926,12,25),YMOtoInt(1989,1,7));
  era["heisei"] = P(YMOtoInt(1989,1,8),1000000000);

  while(cin >> Y >> M >> O){
    int RYDEEN = YMOtoInt(Y,M,O);
 
    bool yes = true;
    foreach(i,era){     
    if((*i).S.F <= RYDEEN && RYDEEN <= (*i).S.S){
      cout << (*i).F << endl;
      yes = false;
      break;
    }
  }
    if(yes)cout << "pre-meiji" << endl;
    


  }
  return 0;
}