#include<iostream>
#include<algorithm>

using namespace std;

int y,m,d;

int eraname(){
  string str = "";
  int data[3] = {d,m,y};
  for(int i = 0; i < 3; i++){
    int flg = 0;
    if(data[i] < 10) flg = 1;
    while(data[i]){
      str += data[i]%10+'0';
      data[i]/=10;
    }
    if(flg) str += "0";
  }
  reverse(str.begin(),str.end());
  // cout<< "str  " << str << endl;
  if(str < "18680908") return -1;
  if(str < "19120730") return 1868;
  if(str < "19261225") return 1912;
  if(str < "19890108") return 1926;
  return 1989;
  
}

void printera(int num){
  if(num == -1) cout << "pre-meiji" << endl;
  if(num == 1868) cout << "meiji ";
  if(num == 1912) cout << "taisho ";
  if(num == 1926) cout << "showa ";
  if(num == 1989) cout << "heisei ";
}
int main(){
  while(cin >> y >> m >> d){
    int now = eraname();
    printera(now);
    if(now != -1)
      cout << y-now+1 << " " << m << " "<<d << endl;
  }
  return 0;
}