#include<iostream>
using namespace std;
int main(){
  int age,m,d;
  while(cin>>age>>m>>d){
    if(age>1989||(age==1989&&m>=2)||(age==1989&&m==1&&d>=8)){
      cout << "heisei " << age - 1989 + 1 << ' ' << m << ' ' << d << endl;
    } else if(age>1926||(age==1926&&m==12&&d>=25)){
      cout << "showa " << age - 1926 + 1 << ' ' << m << ' ' << d << endl;
    } else if(age>1912||(age==1912&&m>=8)||(age==1912&&m==7&&d>=30)){
      cout << "taisyo " << age - 1912 + 1 << ' ' << m << ' ' << d << endl;
    } else if(age>1868||(age==1868&&m>=10)||(age==1868&&m==9&&d>=8)){
      cout << "meiji " << age - 1868 + 1 << ' ' << m << ' ' << d << endl;
    } else cout << "pre-meiji" << endl;
  }
  return 0;
}